NextIntlClientProvider SSR wrapper triggers Couldn't-find-config-file on every render in Next 16.2.4 + Turbopack production #2340
Unanswered
pulse-ventures
asked this question in
Q&A
Replies: 1 comment
|
Moving to a discussion since no reproduction was provided and this appears to be a usage question. Please be sure to check working examples. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Environment
next-intl:4.12.0next:16.2.4(stable Turbopack production build)22.x(Vercel runtime)en-GB), no[locale]segment, locale + messages hardcodedSymptom
Every server render returns HTTP 500 with the runtime error:
Build status is
Ready— the throw is purely at request time. Localpnpm devandpnpm buildboth succeed.Reproduction
next.config.ts:src/i18n/request.ts:src/app/layout.tsx:Deploy to Vercel with
next build(Turbopack, the Next 16 default). Visit/. → HTTP 500.Root cause analysis
The Turbopack alias
next-intl/configset bycreateNextIntlPlugin()does not bind to the production server bundle. Tried all of the following without effect (chunk hash changed but the throw persisted):nextConfig.turbopack.resolveAlias['next-intl/config']manuallynextConfig.experimental.turbo.resolveAlias['next-intl/config']manuallyexperimental.turboentirely (the plugin's slot-detection check isi() && !t?.experimental?.turbo)The fallback module at
next-intl/dist/esm/production/config.jsalways wins:Looking at
NextIntlClientProviderServer.js(the SSR wrapper Next renders on the server when a clientNextIntlClientProvideris used inside an async server layout):All five fallbacks (
getFormats,getLocale,getMessages,getConfigNow,getTimeZone) callgetConfig()internally, which loadsnext-intl/config→ throw-stub.In the repro above, only
localeandmessagesare passed, sogetFormats()/getConfigNow()/getTimeZone()still fire and all 500.Workaround
Pass every prop the SSR wrapper falls back on:
After this, the home page renders to HTTP 200. Server-side
getTranslations()/getLocale()/getMessages()calls in OTHER routes still hit the same broken alias path and 500 — they need the same prop-passing or the underlying alias issue to be fixed.Suggested fixes
Investigate why the Turbopack alias doesn't bind in Next 16.2.4 production. The plugin source's
i() && !t?.experimental?.turboslot-detection routes correctly tonextConfig.turbopack.resolveAliasfor Next ≥ 15.3, but the resulting alias appears not to apply to the server bundle. Could be a Turbopack regression or a chunking interaction with next-intl's pre-bundledreact-server_getConfigmodule.Document the SSR prop-fallback surface more loudly. The current
<NextIntlClientProvider>docs imply onlylocale+messagesare needed; the server wrapper's hidden calls togetFormats/getConfigNow/getTimeZoneare surprising and turn a misconfigured alias into a full production outage.Make the fallback throw-stub more helpful — point at the relevant Turbopack alias diagnostic, not just the generic "follow getting-started" link. The error stack lands inside a content-hashed chunk and is currently very hard to map back to root cause.
Surrounding context
Documented in a 7-PR debugging cycle for an internal DruOps app. Happy to share full logs / chunk inspect URLs / Vercel deployment IDs privately if useful.
All reactions