Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18next::backendConnector: TypeError: Failed to parse URL #2162

Open
dcts opened this issue Mar 15, 2024 · 1 comment
Open

i18next::backendConnector: TypeError: Failed to parse URL #2162

dcts opened this issue Mar 15, 2024 · 1 comment
Labels

Comments

@dcts
Copy link

dcts commented Mar 15, 2024

馃悰 [Bug Report] Failed to parse URL error log

When integrating i18next into a nextJS app, everything works as expected, unless that everytime a page is loaded (by opening localhost:3000), I get an error message in my server logs. The translation and everything on the frontend still works and all translation JSON files are successfully loaded.

This is the logged error:

i18next::backendConnector: loading namespace translation for language en failed TypeError: Failed to parse URL from /locales/en/translation.json
    at new _Request (node:internal/deps/undici/undici:5057:19)
    at R (/home/dcts/code/dexteronradix/website/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:340580)
    at doOriginalFetch (webpack-internal:///(rsc)/./node_modules/next/dist/server/lib/patch-fetch.js:380:24)
    at eval (webpack-internal:///(rsc)/./node_modules/next/dist/server/lib/patch-fetch.js:508:20) {
  [cause]: TypeError [ERR_INVALID_URL]: Invalid URL
      at new NodeError (node:internal/errors:405:5)
      at new URL (node:internal/url:637:13)
      at new _Request (node:internal/deps/undici/undici:5055:25)
      at R (/home/dcts/code/dexteronradix/website/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:340580)
      at doOriginalFetch (webpack-internal:///(rsc)/./node_modules/next/dist/server/lib/patch-fetch.js:380:24)
      at eval (webpack-internal:///(rsc)/./node_modules/next/dist/server/lib/patch-fetch.js:508:20) {
    input: '/locales/en/translation.json',
    code: 'ERR_INVALID_URL'
  }
}

When I check the path localhost:3000/locales/en/translation.json I can access the json file from my browser.

To Reproduce

If there is no obvious explenation to why this is happening I will happily provide a minimal reproducable example.

Expected behavior

No error log in the server logs.

Your Environment

  • runtime version: node v18.18.2
  • i18next version: "react-i18next": "^14.1.0"
  • os: Linux (Ubuntu 22.04 LTS)
@adrai
Copy link
Member

adrai commented Mar 15, 2024

You're probably talking about next-i18next...
Yes, please provide an example first.

@adrai adrai added the stale label May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants