QuiiBz / next-international

Type-safe internationalization (i18n) for Next.js
https://next-international.vercel.app
MIT License
1.2k stars 52 forks source link

[On page enter][Not blocking error] RangeError: A proper locale must be provided #349

Open gustaveWPM opened 5 months ago

gustaveWPM commented 5 months ago

Hello!

Describe the bug When I enter on a page for the first time with an another locale than the default locale, I get the following error:

RangeError: A proper locale must be provided
    at new a (/home/stan/Delivery/dashboard_rtm/.next/server/chunks/526.js:1:208125)
    at m (/home/stan/Delivery/dashboard_rtm/.next/server/chunks/332.js:1:29693)
    at em (/home/stan/Delivery/dashboard_rtm/node_modules/.pnpm/next@14.1.0_@babel+core@7.23.6_@opentelemetry+api@1.7.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:131226)
    at /home/stan/Delivery/dashboard_rtm/node_modules/.pnpm/next@14.1.0_@babel+core@7.23.6_@opentelemetry+api@1.7.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:142926
    at Array.toJSON (/home/stan/Delivery/dashboard_rtm/node_modules/.pnpm/next@14.1.0_@babel+core@7.23.6_@opentelemetry+api@1.7.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:146504)
    at stringify (<anonymous>)
    at eR (/home/stan/Delivery/dashboard_rtm/node_modules/.pnpm/next@14.1.0_@babel+core@7.23.6_@opentelemetry+api@1.7.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:134889)
    at eP (/home/stan/Delivery/dashboard_rtm/node_modules/.pnpm/next@14.1.0_@babel+core@7.23.6_@opentelemetry+api@1.7.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:135332)
    at Timeout._onTimeout (/home/stan/Delivery/dashboard_rtm/node_modules/.pnpm/next@14.1.0_@babel+core@7.23.6_@opentelemetry+api@1.7.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:132112)
    at listOnTimeout (node:internal/timers:573:17)
[Error: An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.] {
  digest: '269968065'
}
TypeError: e[o] is not a function
    at /home/stan/Delivery/dashboard_rtm/.next/server/chunks/526.js:1:213058
    at Generator.next (<anonymous>)
    at /home/stan/Delivery/dashboard_rtm/.next/server/chunks/526.js:1:210792
    at new Promise (<anonymous>)
    at d (/home/stan/Delivery/dashboard_rtm/.next/server/chunks/526.js:1:210612)
    at /home/stan/Delivery/dashboard_rtm/.next/server/chunks/526.js:1:212949
    at Module.c (/home/stan/Delivery/dashboard_rtm/.next/server/chunks/332.js:1:30162)
    at /home/stan/Delivery/dashboard_rtm/node_modules/.pnpm/next@14.1.0_@babel+core@7.23.6_@opentelemetry+api@1.7.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:225165
    at /home/stan/Delivery/dashboard_rtm/node_modules/.pnpm/next@14.1.0_@babel+core@7.23.6_@opentelemetry+api@1.7.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/server/lib/trace/tracer.js:133:36
    at NoopContextManager.with (/home/stan/Delivery/dashboard_rtm/node_modules/.pnpm/@opentelemetry+api@1.7.0/node_modules/@opentelemetry/api/build/src/context/NoopContextManager.js:25:19)

To Reproduce Steps to reproduce the behavior:

  1. Clone this repo https://github.com/tirraa/dashboard_rtm/
  2. Run make install
  3. Run make initialize-env
  4. Run make (or make build)
  5. Run make start
  6. Go on the app http://localhost:3000/
  7. Change the language to "English"
  8. Refresh the page
  9. The error is printed in the terminal

Expected behavior No error should be thrown, I guess?

About (please complete the following information):

Additional context This error does not block the rendering of the page.

You can also use make prebuild-rtm && make dev instead of make && make start to run the app in dev mode.

QuiiBz commented 4 months ago

Interesting, I don't know where this "A proper locale must be provided" error is coming from though 🤔

gustaveWPM commented 4 months ago

Interesting, I don't know where this "A proper locale must be provided" error is coming from though 🤔

Sorry, I've provided a rather huge project "to reproduce"... I'll try to see if I can isolate this error better in the future. Right now I'm very busy putting the finishing touches to the PoC of my "Glue" between Contentlayer and Next International. ^^"