locale is always the default locale on page reload when using the pages router + middleware + edge runtime #61201
Labels
bug
Issue was opened via the bug report template.
Navigation
Related to Next.js linking (e.g., <Link>) and navigation.
Runtime
Related to Node.js or Edge Runtime with Next.js.
Link to the code that reproduces this issue
https://github.com/gabrielf/next-edge-runtime-locale-bug
To Reproduce
npm run dev
http://localhost:3000/en
in a browserCurrent vs. Expected behavior
As I visit
/en
I expect the locale to been
but it isdefault
.Clicking the link
English
leads to a client side navigation to the same page which correctly shows the locale asen
.Additional links and their purpose:
Dynamic route 1
- exists to show that the problem exists also for dynamic routes, not just static onesStatic route (unaffected)
- exists to show that the problem does not exist on routes that does not match the middlewareProvide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.2.0: Wed Nov 15 21:55:06 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6020 Binaries: Node: 18.18.2 npm: 9.8.1 Yarn: N/A pnpm: N/A Relevant Packages: next: 14.1.1-canary.12 // Latest available version is detected (14.1.1-canary.12). eslint-config-next: N/A react: 18.2.0 react-dom: 18.2.0 typescript: N/A Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
Internationalization (i18n), Middleware / Edge (API routes, runtime), Routing (next/router, next/navigation, next/link)
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local), next start (local)
Additional context
The bug may have been introduced in version 13.4.20-canary.24 as using 13.4.20-canary.23 works fine but 24 does not. The bug seems to have existed since then.
The text was updated successfully, but these errors were encountered: