# /red page loading issue - i18next dependency

**URL:** <https://discourse.nodered.org/t/red-page-loading-issue-i18next-dependency/16830>\
**Category:** General\
**Created:** [17 October 2019 19:16 UTC](https://discourse.nodered.org/t/red-page-loading-issue-i18next-dependency/16830 "2019-10-17T19:16:58Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![dotkam](https://avatars.discourse-cdn.com/v4/letter/d/ee7513/32.png) [@dotkam](https://discourse.nodered.org/u/dotkam)\
**Post date:** [17 October 2019 19:16 UTC](https://discourse.nodered.org/t/red-page-loading-issue-i18next-dependency/16830/1 "2019-10-17T19:16:58Z")

</div>

Hi, I experienced an issue opening /red in the browser. I was told to make a separate post for this.

Basically, there is an i18next node\_module for translating languages. Deep within that codebase, there is a bug where if req.param.lng is not included, it breaks. Most of the requests from the /red web page include lng=en-US, but there is a request somewhere that doesn't (chrome and firefox).

Below is my stack trace, and my express server work around.

```auto
Welcome to Node-RED
===================

17 Oct 13:47:30 - [info] Node-RED version: v1.0.2-git
17 Oct 13:47:30 - [info] Node.js version: v8.9.4
17 Oct 13:47:30 - [info] Darwin 17.4.0 x64 LE
17 Oct 13:47:30 - [info] Loading palette nodes
17 Oct 13:47:35 - [info] Context store : 'default' [module=memory]
17 Oct 13:47:35 - [info] User directory : /project/nodered/flows
17 Oct 13:47:35 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable
17 Oct 13:47:35 - [info] Flows file : /project/nodered/flows/flows_clutch.json
17 Oct 13:47:35 - [warn]

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

17 Oct 13:47:35 - [info] Starting flows
17 Oct 13:47:35 - [info] Started flows
17 Oct 13:47:56 - [error] TypeError: Cannot read property 'indexOf' of undefined
    at ResourceStore.getResource (/project/node_modules/i18next/dist/commonjs/ResourceStore.js:83:15)
    at ResourceStore.getResourceBundle (/project/node_modules/i18next/dist/commonjs/ResourceStore.js:174:19)
    at I18n._this2.(anonymous function) [as getResourceBundle] (/project/node_modules/i18next/dist/commonjs/i18next.js:172:56)
    at loadResource (/project/node_modules/@node-red/editor-api/lib/editor/locales.js:25:26)
    at /project/node_modules/@node-red/editor-api/lib/editor/locales.js:48:27
    at done (/project/node_modules/i18next/dist/commonjs/i18next.js:307:23)
    at /project/node_modules/i18next/dist/commonjs/i18next.js:321:11
    at Connector.prepareLoading (/project/node_modules/i18next/dist/commonjs/BackendConnector.js:217:37)
    at Connector.load (/project/node_modules/i18next/dist/commonjs/BackendConnector.js:229:12)
    at I18n.loadResources (/project/node_modules/i18next/dist/commonjs/i18next.js:239:40)
    at setLng (/project/node_modules/i18next/dist/commonjs/i18next.js:320:16)
    at I18n.changeLanguage (/project/node_modules/i18next/dist/commonjs/i18next.js:330:9)
    at get (/project/node_modules/@node-red/editor-api/lib/editor/locales.js:47:16)
    at Layer.handle [as handle_request] (/project/node_modules/express/lib/router/layer.js:95:5)
    at next (/project/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/project/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/project/node_modules/express/lib/router/layer.js:95:5)
    at /project/node_modules/express/lib/router/index.js:281:22
    at param (/project/node_modules/express/lib/router/index.js:354:14)
    at param (/project/node_modules/express/lib/router/index.js:365:14)
    at Function.process_params (/project/node_modules/express/lib/router/index.js:410:3)
    at next (/project/node_modules/express/lib/router/index.js:275:10)
    at SendStream.error (/project/node_modules/serve-static/index.js:121:7)
    at emitOne (events.js:116:13)
    at SendStream.emit (events.js:211:7)
    at SendStream.error (/project/node_modules/send/index.js:270:17)
    at SendStream.onStatError (/project/node_modules/send/index.js:421:12)
    at next (/project/node_modules/send/index.js:735:16)
    at onstat (/project/node_modules/send/index.js:724:14)
    at FSReqWrap.oncomplete (fs.js:152:21)
17 Oct 13:47:56 - [error] TypeError: Cannot read property 'indexOf' of undefined
    at ResourceStore.getResource (/project/node_modules/i18next/dist/commonjs/ResourceStore.js:83:15)
    at ResourceStore.getResourceBundle (/project/node_modules/i18next/dist/commonjs/ResourceStore.js:174:19)
    at I18n._this2.(anonymous function) [as getResourceBundle] (/project/node_modules/i18next/dist/commonjs/i18next.js:172:56)
    at loadResource (/project/node_modules/@node-red/editor-api/lib/editor/locales.js:25:26)
    at /project/node_modules/@node-red/editor-api/lib/editor/locales.js:48:27
    at done (/project/node_modules/i18next/dist/commonjs/i18next.js:307:23)
    at /project/node_modules/i18next/dist/commonjs/i18next.js:321:11
    at Connector.prepareLoading (/project/node_modules/i18next/dist/commonjs/BackendConnector.js:217:37)
    at Connector.load (/project/node_modules/i18next/dist/commonjs/BackendConnector.js:229:12)
    at I18n.loadResources (/project/node_modules/i18next/dist/commonjs/i18next.js:239:40)
    at setLng (/project/node_modules/i18next/dist/commonjs/i18next.js:320:16)
    at I18n.changeLanguage (/project/node_modules/i18next/dist/commonjs/i18next.js:330:9)
    at get (/project/node_modules/@node-red/editor-api/lib/editor/locales.js:47:16)
    at Layer.handle [as handle_request] (/project/node_modules/express/lib/router/layer.js:95:5)
    at next (/project/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/project/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/project/node_modules/express/lib/router/layer.js:95:5)
    at /project/node_modules/express/lib/router/index.js:281:22
    at param (/project/node_modules/express/lib/router/index.js:354:14)
    at param (/project/node_modules/express/lib/router/index.js:365:14)
    at Function.process_params (/project/node_modules/express/lib/router/index.js:410:3)
    at next (/project/node_modules/express/lib/router/index.js:275:10)
    at SendStream.error (/project/node_modules/serve-static/index.js:121:7)
    at emitOne (events.js:116:13)
    at SendStream.emit (events.js:211:7)
    at SendStream.error (/project/node_modules/send/index.js:270:17)
    at SendStream.onStatError (/project/node_modules/send/index.js:421:12)
    at next (/project/node_modules/send/index.js:735:16)
    at onstat (/project/node_modules/send/index.js:724:14)
    at FSReqWrap.oncomplete (fs.js:152:21)
17 Oct 13:47:56 - [error] TypeError: Cannot read property 'indexOf' of undefined
    at ResourceStore.getResource (/project/node_modules/i18next/dist/commonjs/ResourceStore.js:83:15)
    at ResourceStore.getResourceBundle (/project/node_modules/i18next/dist/commonjs/ResourceStore.js:174:19)
    at I18n._this2.(anonymous function) [as getResourceBundle] (/project/node_modules/i18next/dist/commonjs/i18next.js:172:56)
    at loadResource (/project/node_modules/@node-red/editor-api/lib/editor/locales.js:25:26)
    at /project/node_modules/@node-red/editor-api/lib/editor/locales.js:48:27
    at done (/project/node_modules/i18next/dist/commonjs/i18next.js:307:23)
    at /project/node_modules/i18next/dist/commonjs/i18next.js:321:11
    at Connector.prepareLoading (/project/node_modules/i18next/dist/commonjs/BackendConnector.js:217:37)
    at Connector.load (/project/node_modules/i18next/dist/commonjs/BackendConnector.js:229:12)
    at I18n.loadResources (/project/node_modules/i18next/dist/commonjs/i18next.js:239:40)
    at setLng (/project/node_modules/i18next/dist/commonjs/i18next.js:320:16)
    at I18n.changeLanguage (/project/node_modules/i18next/dist/commonjs/i18next.js:330:9)
    at get (/project/node_modules/@node-red/editor-api/lib/editor/locales.js:47:16)
    at Layer.handle [as handle_request] (/project/node_modules/express/lib/router/layer.js:95:5)
    at next (/project/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/project/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/project/node_modules/express/lib/router/layer.js:95:5)
    at /project/node_modules/express/lib/router/index.js:281:22
    at param (/project/node_modules/express/lib/router/index.js:354:14)
    at param (/project/node_modules/express/lib/router/index.js:365:14)
    at Function.process_params (/project/node_modules/express/lib/router/index.js:410:3)
    at next (/project/node_modules/express/lib/router/index.js:275:10)
    at SendStream.error (/project/node_modules/serve-static/index.js:121:7)
    at emitOne (events.js:116:13)
    at SendStream.emit (events.js:211:7)
    at SendStream.error (/project/node_modules/send/index.js:270:17)
    at SendStream.onStatError (/project/node_modules/send/index.js:421:12)
    at next (/project/node_modules/send/index.js:735:16)
    at onstat (/project/node_modules/send/index.js:724:14)
    at FSReqWrap.oncomplete (fs.js:152:21)
17 Oct 13:47:56 - [error] TypeError: Cannot read property 'indexOf' of undefined
    at ResourceStore.getResource (/project/node_modules/i18next/dist/commonjs/ResourceStore.js:83:15)
    at ResourceStore.getResourceBundle (/project/node_modules/i18next/dist/commonjs/ResourceStore.js:174:19)
    at I18n._this2.(anonymous function) [as getResourceBundle] (/project/node_modules/i18next/dist/commonjs/i18next.js:172:56)
    at loadResource (/project/node_modules/@node-red/editor-api/lib/editor/locales.js:25:26)
    at /project/node_modules/@node-red/editor-api/lib/editor/locales.js:48:27
    at done (/project/node_modules/i18next/dist/commonjs/i18next.js:307:23)
    at /project/node_modules/i18next/dist/commonjs/i18next.js:321:11
    at Connector.prepareLoading (/project/node_modules/i18next/dist/commonjs/BackendConnector.js:217:37)
    at Connector.load (/project/node_modules/i18next/dist/commonjs/BackendConnector.js:229:12)
    at I18n.loadResources (/project/node_modules/i18next/dist/commonjs/i18next.js:239:40)
    at setLng (/project/node_modules/i18next/dist/commonjs/i18next.js:320:16)
    at I18n.changeLanguage (/project/node_modules/i18next/dist/commonjs/i18next.js:330:9)
    at get (/project/node_modules/@node-red/editor-api/lib/editor/locales.js:47:16)
    at Layer.handle [as handle_request] (/project/node_modules/express/lib/router/layer.js:95:5)
    at next (/project/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/project/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/project/node_modules/express/lib/router/layer.js:95:5)
    at /project/node_modules/express/lib/router/index.js:281:22
    at param (/project/node_modules/express/lib/router/index.js:354:14)
    at param (/project/node_modules/express/lib/router/index.js:365:14)
    at Function.process_params (/project/node_modules/express/lib/router/index.js:410:3)
    at next (/project/node_modules/express/lib/router/index.js:275:10)
    at SendStream.error (/project/node_modules/serve-static/index.js:121:7)
    at emitOne (events.js:116:13)
    at SendStream.emit (events.js:211:7)
    at SendStream.error (/project/node_modules/send/index.js:270:17)
    at SendStream.onStatError (/project/node_modules/send/index.js:421:12)
    at next (/project/node_modules/send/index.js:735:16)
    at onstat (/project/node_modules/send/index.js:724:14)
    at FSReqWrap.oncomplete (fs.js:152:21)
TypeError: Cannot read property 'indexOf' of undefined
    at ResourceStore.getResource (/project/node_modules/i18next/dist/commonjs/ResourceStore.js:83:15)
    at ResourceStore.getResourceBundle (/project/node_modules/i18next/dist/commonjs/ResourceStore.js:174:19)
    at I18n._this2.(anonymous function) [as getResourceBundle] (/project/node_modules/i18next/dist/commonjs/i18next.js:172:56)
    at /project/node_modules/@node-red/runtime/lib/api/nodes.js:374:55
    at Array.forEach (<anonymous>)
    at /project/node_modules/@node-red/runtime/lib/api/nodes.js:372:26
    at done (/project/node_modules/i18next/dist/commonjs/i18next.js:307:23)
    at /project/node_modules/i18next/dist/commonjs/i18next.js:321:11
    at Connector.prepareLoading (/project/node_modules/i18next/dist/commonjs/BackendConnector.js:217:37)
    at Connector.load (/project/node_modules/i18next/dist/commonjs/BackendConnector.js:229:12)
    at I18n.loadResources (/project/node_modules/i18next/dist/commonjs/i18next.js:239:40)
    at setLng (/project/node_modules/i18next/dist/commonjs/i18next.js:320:16)
    at I18n.changeLanguage (/project/node_modules/i18next/dist/commonjs/i18next.js:330:9)
    at /project/node_modules/@node-red/runtime/lib/api/nodes.js:369:28
    at new Promise (<anonymous>)
    at Object.getModuleCatalogs (/project/node_modules/@node-red/runtime/lib/api/nodes.js:364:16)
    at getModuleCatalogs (/project/node_modules/@node-red/editor-api/lib/admin/nodes.js:166:26)
    at Layer.handle [as handle_request] (/project/node_modules/express/lib/router/layer.js:95:5)
    at next (/project/node_modules/express/lib/router/route.js:137:13)
    at /project/node_modules/@node-red/editor-api/lib/auth/index.js:68:28
    at complete (/project/node_modules/passport/lib/middleware/authenticate.js:263:13)
    at /project/node_modules/passport/lib/middleware/authenticate.js:270:15
    at pass (/project/node_modules/passport/lib/authenticator.js:431:14)
    at Authenticator.transformAuthInfo (/project/node_modules/passport/lib/authenticator.js:453:5)
    at /project/node_modules/passport/lib/middleware/authenticate.js:267:22
    at IncomingMessage.req.login.req.logIn (/project/node_modules/passport/lib/http/request.js:55:13)
    at Strategy.strategy.success (/project/node_modules/passport/lib/middleware/authenticate.js:248:13)
    at verified (/project/node_modules/passport-http-bearer/lib/strategy.js:126:10)
    at /project/node_modules/@node-red/editor-api/lib/auth/strategies.js:37:21
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:228:7)

```

my package-lock.js file:

```auto
    "node-red": {
      "version": "1.0.2",
      "resolved": "https://registry.npmjs.org/node-red/-/node-red-1.0.2.tgz",
      "integrity": "sha512-QSyPpAGGVFgVlKyumWFd8j2hd420+sh8DSxlvAtatDVaIG3+MaAD3eDLg49HIwRyAhiROVS1XNWkqyq/H1/cBA==",
      "requires": {
        "@node-red/editor-api": "1.0.2",
        "@node-red/nodes": "1.0.2",
        "@node-red/runtime": "1.0.2",
        "@node-red/util": "1.0.2",
        "basic-auth": "2.0.1",
        "bcrypt": "3.0.6",
        "bcryptjs": "2.4.3",
        "express": "4.17.1",
        "fs-extra": "8.1.0",
        "node-red-node-rbe": "^0.2.5",
        "node-red-node-tail": "^0.0.3",
        "nopt": "4.0.1",
        "semver": "6.3.0"
      },
      "dependencies": {
        "semver": {
          "version": "6.3.0",
          "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
          "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="
        }
      }
    },
    "node-red-node-mongodb": {
      "version": "0.0.14",
      "resolved": "https://registry.npmjs.org/node-red-node-mongodb/-/node-red-node-mongodb-0.0.14.tgz",
      "integrity": "sha512-hlXhi7+BuQVamJ/y3qxvoGWGReivRtkgPmZy0UEO0gkWAzgjI2OplMfXAYKA0viqQS2Qd4DlPFpap3a4nS9M5w==",
      "requires": {
        "mongodb": "^2.2.34"
      }
    },
    "node-red-node-rbe": {
      "version": "0.2.5",
      "resolved": "https://registry.npmjs.org/node-red-node-rbe/-/node-red-node-rbe-0.2.5.tgz",
      "integrity": "sha512-WPwIOZIdDprgfqOe8bEun47wkFFc+5Uw/1w3O/kZn/kS2IpI1q+wijUDK+Hw8q4d8KgA58B30wh+10UvXzsPDA=="
    },
    "node-red-node-tail": {
      "version": "0.0.3",
      "resolved": "https://registry.npmjs.org/node-red-node-tail/-/node-red-node-tail-0.0.3.tgz",
      "integrity": "sha512-wEiT7bSeU9oVHPK7S+mHb3cR6cIf9l205wTiHzhnUAuoDJS+IdwQkkpFgKTYmkL4Py2LvqCU90h85YpQul7QFQ==",
      "requires": {
        "tail": "^2.0.2"
      }
    },

    "@node-red/editor-api": {
      "version": "1.0.2",
      "resolved": "https://registry.npmjs.org/@node-red/editor-api/-/editor-api-1.0.2.tgz",
      "integrity": "sha512-yUvTU5b7gDL35NIC2qC54NY0uuIAewVzcPWsc+Rbjy9YpY1DUD2Gt5Ub9gR2QPWYtVPG4zSPOBtPhZEcZvBSxQ==",
      "requires": {
        "@node-red/editor-client": "1.0.2",
        "@node-red/util": "1.0.2",
        "bcrypt": "3.0.6",
        "bcryptjs": "2.4.3",
        "body-parser": "1.19.0",
        "clone": "2.1.2",
        "cors": "2.8.5",
        "express": "4.17.1",
        "express-session": "1.16.2",
        "memorystore": "1.6.1",
        "mime": "2.4.4",
        "mustache": "3.0.2",
        "oauth2orize": "1.11.0",
        "passport": "0.4.0",
        "passport-http-bearer": "1.0.1",
        "passport-oauth2-client-password": "0.1.2",
        "when": "3.7.8",
        "ws": "6.2.1"
      }
    },
    "@node-red/editor-client": {
      "version": "1.0.2",
      "resolved": "https://registry.npmjs.org/@node-red/editor-client/-/editor-client-1.0.2.tgz",
      "integrity": "sha512-BhgzwWjxjrQJnZC/BMIZvco4H5ksZl+qh+3hy40ReDrNpp8xSc3mDIFoB785CZrYBtFMhasE2q0kqdYuNKE/Zw=="
    },
    "@node-red/nodes": {
      "version": "1.0.2",
      "resolved": "https://registry.npmjs.org/@node-red/nodes/-/nodes-1.0.2.tgz",
      "integrity": "sha512-o5N0FZnLAEd1lF2ArLGoETosukFVI+nPTHWKUOoSd069eLuaS262BOTbbnk/oY4H2DEWQzjGZ2KKBItWlhbpXQ==",
      "requires": {
        "ajv": "6.10.2",
        "body-parser": "1.19.0",
        "cheerio": "0.22.0",
        "content-type": "1.0.4",
        "cookie": "0.4.0",
        "cookie-parser": "1.4.4",
        "cors": "2.8.5",
        "cron": "1.7.1",
        "denque": "1.4.1",
        "fs-extra": "8.1.0",
        "fs.notify": "0.0.4",
        "hash-sum": "2.0.0",
        "https-proxy-agent": "2.2.2",
        "iconv-lite": "0.5.0",
        "is-utf8": "0.2.1",
        "js-yaml": "3.13.1",
        "media-typer": "1.1.0",
        "mqtt": "2.18.8",
        "multer": "1.4.2",
        "mustache": "3.0.2",
        "on-headers": "1.0.2",
        "raw-body": "2.4.1",
        "request": "2.88.0",
        "ws": "6.2.1",
        "xml2js": "0.4.19"
      },
      "dependencies": {
        "ajv": {
          "version": "6.10.2",
          "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz",
          "integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==",
          "requires": {
            "fast-deep-equal": "^2.0.1",
            "fast-json-stable-stringify": "^2.0.0",
            "json-schema-traverse": "^0.4.1",
            "uri-js": "^4.2.2"
          }
        },
        "debug": {
          "version": "3.2.6",
          "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
          "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
          "requires": {
            "ms": "^2.1.1"
          }
        },
        "http-errors": {
          "version": "1.7.3",
          "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.3.tgz",
          "integrity": "sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw==",
          "requires": {
            "depd": "~1.1.2",
            "inherits": "2.0.4",
            "setprototypeof": "1.1.1",
            "statuses": ">= 1.5.0 < 2",
            "toidentifier": "1.0.0"
          }
        },
        "https-proxy-agent": {
          "version": "2.2.2",
          "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.2.tgz",
          "integrity": "sha512-c8Ndjc9Bkpfx/vCJueCPy0jlP4ccCCSNDp8xwCZzPjKJUm+B+u9WX2x98Qx4n1PiMNTWo3D7KK5ifNV/yJyRzg==",
          "requires": {
            "agent-base": "^4.3.0",
            "debug": "^3.1.0"
          }
        },
        "iconv-lite": {
          "version": "0.5.0",
          "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.5.0.tgz",
          "integrity": "sha512-NnEhI9hIEKHOzJ4f697DMz9IQEXr/MMJ5w64vN2/4Ai+wRnvV7SBrL0KLoRlwaKVghOc7LQ5YkPLuX146b6Ydw==",
          "requires": {
            "safer-buffer": ">= 2.1.2 < 3"
          }
        },
        "media-typer": {
          "version": "1.1.0",
          "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz",
          "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw=="
        },
        "ms": {
          "version": "2.1.2",
          "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
          "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
        },
        "raw-body": {
          "version": "2.4.1",
          "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.1.tgz",
          "integrity": "sha512-9WmIKF6mkvA0SLmA2Knm9+qj89e+j1zqgyn8aXGd7+nAduPoqgI9lO57SAZNn/Byzo5P7JhXTyg9PzaJbH73bA==",
          "requires": {
            "bytes": "3.1.0",
            "http-errors": "1.7.3",
            "iconv-lite": "0.4.24",
            "unpipe": "1.0.0"
          },
          "dependencies": {
            "iconv-lite": {
              "version": "0.4.24",
              "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
              "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
              "requires": {
                "safer-buffer": ">= 2.1.2 < 3"
              }
            }
          }
        }
      }
    },
    "@node-red/registry": {
      "version": "1.0.2",
      "resolved": "https://registry.npmjs.org/@node-red/registry/-/registry-1.0.2.tgz",
      "integrity": "sha512-i6TZvVriini0732IN2DVMofkG8RmiaLKpkHaP1aRceHvweDQB4yorcQsPDxqU+uiJo3lQlc1oB5j13X3mdq8DQ==",
      "requires": {
        "@node-red/util": "1.0.2",
        "semver": "6.3.0",
        "uglify-js": "3.6.0",
        "when": "3.7.8"
      },
      "dependencies": {
        "semver": {
          "version": "6.3.0",
          "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
          "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="
        }
      }
    },
    "@node-red/runtime": {
      "version": "1.0.2",
      "resolved": "https://registry.npmjs.org/@node-red/runtime/-/runtime-1.0.2.tgz",
      "integrity": "sha512-YMKu5HA4WWYdf2PinysONiEFkmoz+PHD4u9ormREBXPr4iCWmZ2+XqL4QRGAc/RA8FJQ8liCr2rLDUvAuSSVOQ==",
      "requires": {
        "@node-red/registry": "1.0.2",
        "@node-red/util": "1.0.2",
        "clone": "2.1.2",
        "express": "4.17.1",
        "fs-extra": "8.1.0",
        "json-stringify-safe": "5.0.1",
        "when": "3.7.8"
      }
    },
    "@node-red/util": {
      "version": "1.0.2",
      "resolved": "https://registry.npmjs.org/@node-red/util/-/util-1.0.2.tgz",
      "integrity": "sha512-DwaS8ZDcIFcMUQCWpMEVt38Pr6H2JBCeghZEs5v6nH+pnemUi1x6Mi+CSvwywVc4WN4uzGhVr8dWxFh1Q6/iEQ==",
      "requires": {
        "clone": "2.1.2",
        "i18next": "15.1.2",
        "json-stringify-safe": "5.0.1",
        "jsonata": "1.6.5",
        "when": "3.7.8"
      }
    },

```

---

<div class="post-metadata">

**Author:** ![dotkam](https://avatars.discourse-cdn.com/v4/letter/d/ee7513/32.png) [@dotkam](https://discourse.nodered.org/u/dotkam)\
**Post date:** [17 October 2019 19:17 UTC](https://discourse.nodered.org/t/red-page-loading-issue-i18next-dependency/16830/2 "2019-10-17T19:17:45Z")

</div>

Express server workaround:

```auto
const querystring = require('querystring');
const app = express();

app.use(function(req, res, next){
    req.query = Object.assign({lng: 'en-US'}, querystring.parse(req.query()));
    next();
});

const server ....

```

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [17 October 2019 21:26 UTC](https://discourse.nodered.org/t/red-page-loading-issue-i18next-dependency/16830/3 "2019-10-17T21:26:10Z")

</div>

Hi @dotkam

I can confirm that trying to load a message catalog without the `lng` parameter hits this error - that's a bug that needs fixing. Please raise an issue - [https://github.com/node-red/node-red/issues/new?assignees=&labels=&template=--bug\_report.md&title=](https://github.com/node-red/node-red/issues/new?assignees=&labels=&template=--bug_report.md&title=)

However I'm interested to know why you are hitting this but no-one else is. All the message catalog requests the editor makes will include the required parameter: [https://github.com/node-red/node-red/blob/78b735276b6fa3f37a35ecadab17fe19ec0704d3/packages/node\_modules/%40node-red/editor-client/src/js/i18n.js#L26](https://github.com/node-red/node-red/blob/78b735276b6fa3f37a35ecadab17fe19ec0704d3/packages/node_modules/%40node-red/editor-client/src/js/i18n.js#L26)

Maybe you could use your browser's developer console to narrow down which request is triggering the error - it should be easy to find as it gets a 400 status code.

I note you are using the code from git - is that for a specific reason?

---

<div class="post-metadata">

**Author:** ![Klervix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/klervix/32/12234_2.png) [@Klervix](https://discourse.nodered.org/u/Klervix)\
**Post date:** [18 October 2019 13:13 UTC](https://discourse.nodered.org/t/red-page-loading-issue-i18next-dependency/16830/4 "2019-10-18T13:13:21Z")

</div>

I have the same issue on my projects - can't understand why.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [18 October 2019 13:53 UTC](https://discourse.nodered.org/t/red-page-loading-issue-i18next-dependency/16830/5 "2019-10-18T13:53:56Z")

</div>

@Klervix I'm sorry to hear that. In my comment above I've asked a couple questions of @dotkam to help us understand what is going on. Rather than just saying you're seeing the same problem, are you able to share are more specific information to help?

---

<div class="post-metadata">

**Author:** ![JpEncausse](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jpencausse/32/2561_2.png) [@JpEncausse](https://discourse.nodered.org/u/JpEncausse)\
**Post date:** [18 October 2019 14:22 UTC](https://discourse.nodered.org/t/red-page-loading-issue-i18next-dependency/16830/6 "2019-10-18T14:22:31Z")

</div>

Hello @knolleary we are digging,

- Server is upgrade to Node v10.16.3 / Node-Red v1.0.2
- Client Browser and OS is in fr-FR
- The query contains lng=fr-FR
- And in @node-red/editor-api/lib/editor/locales.js the lang var is set fr-FR

So the library try to load the resource of the FR catalogue that do not exist and do not default to something like en-US.

If we override the lang var (in the code) to en-US it works. But we try to understand why it is broken and do not default ?

Is there some default language somewhere (I don't see it in settings)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [18 October 2019 14:26 UTC](https://discourse.nodered.org/t/red-page-loading-issue-i18next-dependency/16830/7 "2019-10-18T14:26:23Z")

</div>

@JpEncausse I have confirmed that if the `lng` parameter is not present then it causes an error in the node-red log.

If the `lng` parameter is present for a language we don't support you'll get an empty catalog. The editor already falls back to `en-US` if a language is not available.

So what are issue are you digging into? The original error or something else?

---

<div class="post-metadata">

**Author:** ![JpEncausse](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jpencausse/32/2561_2.png) [@JpEncausse](https://discourse.nodered.org/u/JpEncausse)\
**Post date:** [18 October 2019 14:35 UTC](https://discourse.nodered.org/t/red-page-loading-issue-i18next-dependency/16830/8 "2019-10-18T14:35:59Z")

</div>

The main problem is that Node-RED login is not translated, and Node-RED UI hangs forever.

In the Chrome Network:

- Ressources are correctly loaded
- Then got : 400 bad Request on

```auto
editor?lng=fr-FR	
editor?lng=en-US	
node-red?lng=fr-FR	
node-red?lng=en-US	
jsonata?lng=fr-FR	
jsonata?lng=en-US	
infotips?lng=fr-FR	
infotips?lng=en-US

```

So yes it try to default to en-US but the response contains :  
`{"error":"unexpected_error","message":"TypeError: Cannot read property 'indexOf' of undefined"}`

I assume the property is the lang tag that migh be lost during the stacktrace :

```auto
TypeError: Cannot read property 'indexOf' of undefined
at ResourceStore.getResource (/path/framework/node_modules/i18next/dist/commonjs/ResourceStore.js:83:15)
at ResourceStore.getResourceBundle (/path/framework/node_modules/i18next/dist/commonjs/ResourceStore.js:174:19)
at I18n._this2.(anonymous function) [as getResourceBundle] (/path/framework/node_modules/i18next/dist/commonjs/i18next.js:172:56)
at /path/framework/node_modules/@node-red/runtime/lib/api/nodes.js:374:55
at Array.forEach (<anonymous>)
at /path/framework/node_modules/@node-red/runtime/lib/api/nodes.js:372:26
at done (/path/framework/node_modules/i18next/dist/commonjs/i18next.js:307:23)
at /path/framework/node_modules/i18next/dist/commonjs/i18next.js:321:11
at Connector.prepareLoading (/path/framework/node_modules/i18next/dist/commonjs/BackendConnector.js:217:37)
at Connector.load (/path/framework/node_modules/i18next/dist/commonjs/BackendConnector.js:229:12)
at I18n.loadResources (/path/framework/node_modules/i18next/dist/commonjs/i18next.js:239:40)
at setLng (/path/framework/node_modules/i18next/dist/commonjs/i18next.js:320:16)
at I18n.changeLanguage (/path/framework/node_modules/i18next/dist/commonjs/i18next.js:330:9)
at /path/framework/node_modules/@node-red/runtime/lib/api/nodes.js:369:28
at new Promise (<anonymous>)
at Object.getModuleCatalogs (/path/framework/node_modules/@node-red/runtime/lib/api/nodes.js:364:16)
at getModuleCatalogs (/path/framework/node_modules/@node-red/editor-api/lib/admin/nodes.js:166:26)
at Layer.handle [as handle_request] (/path/framework/node_modules/express/lib/router/layer.js:95:5)
at next (/path/framework/node_modules/express/lib/router/route.js:137:13)
at /path/framework/node_modules/@node-red/editor-api/lib/auth/index.js:68:28
at complete (/path/framework/node_modules/passport/lib/middleware/authenticate.js:263:13)
at /path/framework/node_modules/passport/lib/middleware/authenticate.js:270:15
at pass (/path/framework/node_modules/passport/lib/authenticator.js:431:14)
at Authenticator.transformAuthInfo (/path/framework/node_modules/passport/lib/authenticator.js:453:5)
at /path/framework/node_modules/passport/lib/middleware/authenticate.js:267:22
at IncomingMessage.req.login.req.logIn (/path/framework/node_modules/passport/lib/http/request.js:55:13)
at Strategy.strategy.success (/path/framework/node_modules/passport/lib/middleware/authenticate.js:248:13)
at verified (/path/framework/node_modules/passport-http-bearer/lib/strategy.js:126:10)
at /path/framework/node_modules/@node-red/editor-api/lib/auth/strategies.js:37:21
at process._tickCallback (internal/process/next_tick.js:68:7)

```

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [18 October 2019 14:38 UTC](https://discourse.nodered.org/t/red-page-loading-issue-i18next-dependency/16830/9 "2019-10-18T14:38:06Z")

</div>

> [@JpEncausse](#):
>
> So yes it try to default to en-US but the response contains :

The response to which request exactly?

I've just set my browser's preferred language to `fr-FR` and I see if load the message catalogs in exactly the order you list and it is all working:

- the fr-FR responses are empty - `{}`
- the en-US responses having the English messages in.

So my question at the start was whether anyone hitting this issue can be more specific as to which request is hitting this error.

---

<div class="post-metadata">

**Author:** ![JpEncausse](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jpencausse/32/2561_2.png) [@JpEncausse](https://discourse.nodered.org/u/JpEncausse)\
**Post date:** [18 October 2019 14:43 UTC](https://discourse.nodered.org/t/red-page-loading-issue-i18next-dependency/16830/10 "2019-10-18T14:43:01Z")

</div>

This error append on all request to Node-RED `http://server:port/path-to-node-red/`  
We probably did something wrong, that what we try to figure out  
It's in the context of a migration from v0.19 to v1.0

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [18 October 2019 14:48 UTC](https://discourse.nodered.org/t/red-page-loading-issue-i18next-dependency/16830/11 "2019-10-18T14:48:55Z")

</div>

> [@JpEncausse](#):
>
> This error append on all request to Node-RED

That isn't quite what I asked.

To load the Node-RED editor from that url results in dozens of further HTTP requests as it loads all of the other resources needed - including the message catalogs.

Loading the url `http://server:port/path-to-node-red/` alone does not cause the error - it will be one of the follow-on requests that causes the error.

The question is which of the follow-on requests is causing the error.

Using the Chrome Developer tools you can see every request that is being made and any that hit a 400 response code will be highlighted in red.

---

<div class="post-metadata">

**Author:** ![dotkam](https://avatars.discourse-cdn.com/v4/letter/d/ee7513/32.png) [@dotkam](https://discourse.nodered.org/u/dotkam)\
**Post date:** [18 October 2019 14:57 UTC](https://discourse.nodered.org/t/red-page-loading-issue-i18next-dependency/16830/12 "2019-10-18T14:57:01Z")

</div>

Hi @knolleary, it is these 5 requests. All of them have that same error message: `"TypeError: Cannot read property 'indexOf' of undefined"`

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/4/4fe7747cbde379e12c42771a95241c880c3d10fe.png)

It's weird how they all have the lng query param on them already.

---

<div class="post-metadata">

**Author:** ![JpEncausse](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jpencausse/32/2561_2.png) [@JpEncausse](https://discourse.nodered.org/u/JpEncausse)\
**Post date:** [18 October 2019 15:03 UTC](https://discourse.nodered.org/t/red-page-loading-issue-i18next-dependency/16830/13 "2019-10-18T15:03:10Z")

</div>

It's all the request I listed previously

 ![chrome](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/3/381d686ff9c9129c508b972e5e8272f17fca62ae.png)

I don't think it's related with a routing error from our Nginx because it target "language request"

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [18 October 2019 15:06 UTC](https://discourse.nodered.org/t/red-page-loading-issue-i18next-dependency/16830/14 "2019-10-18T15:06:27Z")

</div>

> [@JpEncausse](#):
>
> I don't think it's related with a routing error from our Nginx

Ok - so one of my other questions was about any other relevant information about the setup as you are running from git. Now you mention you are running behind nginx.

Have you checked the request still has that parameter attached by the time it reaches Node-RED?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [18 October 2019 15:10 UTC](https://discourse.nodered.org/t/red-page-loading-issue-i18next-dependency/16830/15 "2019-10-18T15:10:12Z")

</div>

As an aside, I've now pushed a fix to the `master` branch to handle requests without the `lng` parameter.

---

<div class="post-metadata">

**Author:** ![Klervix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/klervix/32/12234_2.png) [@Klervix](https://discourse.nodered.org/u/Klervix)\
**Post date:** [18 October 2019 15:44 UTC](https://discourse.nodered.org/t/red-page-loading-issue-i18next-dependency/16830/16 "2019-10-18T15:44:13Z")

</div>

@knolleary,

Thank you for your help. We managed to make it work by changing this file:  
@node-red\runtime\lib\api\nodes.js

The function **getModuleCatalogs** was not setting 'en-US' as default (as explained in the comment), so I just modified this line:  
[366] `var lang = opts.lang || 'en-US';`

Does this make sense?

Have a nice week end

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [18 October 2019 15:49 UTC](https://discourse.nodered.org/t/red-page-loading-issue-i18next-dependency/16830/17 "2019-10-18T15:49:30Z")

</div>

@Klervix are you working on the same issue as @JpEncausse ?

I've fixed this for the `locales/...` endpoint, but I've not looked at the node catalog endpoint, but will check it as well.

But your fix doesn't address the underlying problem you are hitting - for some reason the `lng` parameter is not reaching node-red. So even if there were `fr-FR` translations available, your fix would mean the user always gets the `en-US` files.

Also we wouldn't hardcode `en-US` like that, we'd use the `defaultLang` property from the i18n module so it is only hardcoded in one place.

---

<div class="post-metadata">

**Author:** ![Klervix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/klervix/32/12234_2.png) [@Klervix](https://discourse.nodered.org/u/Klervix)\
**Post date:** [21 October 2019 09:37 UTC](https://discourse.nodered.org/t/red-page-loading-issue-i18next-dependency/16830/18 "2019-10-21T09:37:23Z")

</div>

@knolleary,

Thanks to your last message, I found the real problem, and it came from **restify**. The query parameters were not passed because restify overload some functions (discovered this [here](https://github.com/restify/node-restify/issues/1540)). I uninstalled it and all works perfectly now.  
It was the same as @JpEncausse.

Thank you again for your great help!
