question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: ActiveXObjectApi is not a constructor

See original GitHub issue

🐛 Bug Report

Error in console: TypeError: ActiveXObjectApi is not a constructor at requestWithXmlHttpRequest (/Users/david/werweev2-dev/node_modules/i18next-http-backend/cjs/request.js:105:11) at Object.request (/Users/david/werweev2-dev/node_modules/i18next-http-backend/cjs/request.js:159:12) at Backend.loadUrl (/Users/david/werweev2-dev/node_modules/i18next-http-backend/cjs/index.js:115:20) at Backend.read (/Users/david/werweev2-dev/node_modules/i18next-http-backend/cjs/index.js:108:12) at Connector.read (/Users/david/werweev2-dev/node_modules/i18next/dist/cjs/i18next.js:1669:34) at Connector.loadOne (/Users/david/werweev2-dev/node_modules/i18next/dist/cjs/i18next.js:1727:12) at /Users/david/werweev2-dev/node_modules/i18next/dist/cjs/i18next.js:1703:16 at Array.forEach (<anonymous>) at Connector.prepareLoading (/Users/david/werweev2-dev/node_modules/i18next/dist/cjs/i18next.js:1702:21) at Connector.load (/Users/david/werweev2-dev/node_modules/i18next/dist/cjs/i18next.js:1709:12) at I18n.loadResources (/Users/david/werweev2-dev/node_modules/i18next/dist/cjs/i18next.js:2071:40) at setLng (/Users/david/werweev2-dev/node_modules/i18next/dist/cjs/i18next.js:2167:16) at I18n.changeLanguage (/Users/david/werweev2-dev/node_modules/i18next/dist/cjs/i18next.js:2177:9) at Timeout.load [as _onTimeout] (/Users/david/werweev2-dev/node_modules/i18next/dist/cjs/i18next.js:2021:16) at listOnTimeout (internal/timers.js:554:17) at processTimers (internal/timers.js:497:7)

To Reproduce

I have an i18n.js file that is as follows:

import i18n from "i18next";
import { initReactI18next } from "react-i18next";
import LanguageDetector from 'i18next-browser-languagedetector';
import HttpApi from 'i18next-http-backend';

i18n
  // .use(LanguageDetector)
  .use(initReactI18next) // passes i18n down to react-i18next
  .use(HttpApi)
  .init({
    fallbackLng: "en",
    keySeparator: false, // we do not use keys in form messages.welcome
    interpolation: {
      escapeValue: false // react already safes from xss
    },
    detection: {
        order: ['htmlTag', 'cookie', 'sessionStorage', 'localStorage', 'querystring', 'navigator', 'path', 'subdomain'],
        caches: ['cookie', 'localStorage']
    },
    backend: {
        loadPath: '/api/translation/{{lng}}'
    },
    react: {
        useSuspense: false
    },
    load: 'languageOnly'
  });

  export default i18n;

express.js ( I am doing server-rendering) as follows:

app.get('*', (req, res) => {
  const sheets = new ServerStyleSheets()
  const context = {}
  const store = createStore(rootReducer);
  console.log('req.url', req.url);
  const markup = ReactDOMServer.renderToString(
    sheets.collect(
        <Provider store={store}>
            <StaticRouter location={req.url} context={context}>
              <ThemeProvider theme={theme}>
                <MainRouter />
              </ThemeProvider>
            </StaticRouter>
        </Provider>
    )
  );
  const helmet = Helmet.renderStatic();
  // console.log('helmet', helmet);
  if (context.url) {
    return res.redirect(303, context.url)
  }

  const css = sheets.toString();
  res.status(200).send(Template({
    markup: markup,
    css: css,
    helmet: helmet
  }));
})

not sure if that is related to the error.

Expected behavior

Do you know how can I get rid of this typeError message in the console?

Your Environment

Version tried: “i18next-http-backend”: “^1.2.1”, & “i18next-http-backend”: “^1.2.6”. “i18next”: “^20.2.1”, “i18next-browser-languagedetector”: “^6.1.0”, “i18next-http-backend”: “^1.2.6”,

  • runtime version:
    “node”: “14.16.0”, “npm”: “6.14.4”

  • os: Mac OS Big Sur v11.1

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
adraicommented, May 25, 2022

can you try with v1.4.1 ?

0reactions
eakarpovcommented, May 25, 2022

Yes, the error has gone, thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - ActiveXObject is not defined and can't find variable
ActiveXObject is non-standard and only supported by Internet Explorer on Windows. There is no native cross browser way to write to the file ......
Read more >
Fix: ActiveXobject is not defined - Appuals
Fix: ActiveXobject is not defined · Method 1: Disabling Error debugging and notifications · Method 2: Uninstall add-ins that might be causing the ......
Read more >
How to reference ActiveXObject ? - CodeProject
http://stackoverflow.com/questions/11101641/activexobject-is-not-defined-and-cant-find-variable-activexobject[^].
Read more >
TypeError: __webpack_require__.g.ActiveXObject is ... - GitHub
Just checked g variable in webpack by logging it in console (in centifuge.js). There is no "ActiveXObject" at all. So it is undefined....
Read more >
Error activexobject is not defined - SmartBear Community
Solved! Go to Solution. Hi, From https://support.smartbear.com/testcomplete/docs/scripting/specifics/javascript-for-jscript-users.htm... : "The ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found