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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

locale is always the default locale on page reload when using the pages router + middleware + edge runtime #61201

Open
gabrielf opened this issue Jan 26, 2024 · 2 comments
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.

Comments

@gabrielf
Copy link

Link to the code that reproduces this issue

https://github.com/gabrielf/next-edge-runtime-locale-bug

To Reproduce

  1. Start the minimal bug reproduction using npm run dev
  2. Visit http://localhost:3000/en in a browser

Current vs. Expected behavior

As I visit /en I expect the locale to be en but it is default.

Clicking the link English leads to a client side navigation to the same page which correctly shows the locale as en.

Additional links and their purpose:

  • Dynamic route 1 - exists to show that the problem exists also for dynamic routes, not just static ones
  • Static route (unaffected) - exists to show that the problem does not exist on routes that does not match the middleware

Provide 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.

@gabrielf gabrielf added the bug Issue was opened via the bug report template. label Jan 26, 2024
@github-actions github-actions bot added Runtime Related to Node.js or Edge Runtime with Next.js. Navigation Related to Next.js linking (e.g., <Link>) and navigation. labels Jan 26, 2024
@pierrebiver
Copy link

Same issue here using pages router + middleware and Next js 14.1. When disabling the middleware it works just fine.

@VaDominikKienzler
Copy link

Weird how 13/14 can be considered stable if translations become completely broken when updating ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
None yet
Development

No branches or pull requests

3 participants