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:
- Created 2 years ago
- Reactions:1
- Comments:12 (4 by maintainers)
can you try with v1.4.1 ?
Yes, the error has gone, thanks.