Next.js Discord

Discord Forum

Strange Locale Switching Behavior with NEXT_LOCALE Cookie - Need Help with Debugging

Unanswered
Skipjack tuna posted this in #help-forum
Open in Discord
Skipjack tunaOP
Hello everyone,

First, let me share the repository structure:
https://github.com/FrontLeejonghun/next-intl-replace-bug

Current Issue:
Unfortunately, this issue cannot be reproduced in the repository above, but it consistently occurs in my production application. The next-intl and Next.js versions are identical between both environments.

Steps to Reproduce (in my production app):
1. Access the root path /
2. Automatically redirects to /ko based on locale detection
3. User switches locale to en using the locale switcher
4. NEXT_LOCALE cookie changes: koenko, and in the Network tab, I see a 307 redirect/ko_rsc111

Environment Details:
- The issue occurs only in my production application
- Cannot reproduce in a clean repository with identical versions
- next-intl configuration is 100% identical between both environments
- Next.js and next-intl versions match exactly

Important Note:
The application works perfectly fine with next-intl: ^3.11.3, but this issue appears with newer versions.

Question:
Has anyone experienced similar behavior with locale switching where the NEXT_LOCALE cookie oscillates between values and generates unexpected redirect URLs with suffixes like _rsc111?

Any insights into what might cause this discrepancy between environments would be greatly appreciated. I'm particularly curious about what could cause the cookie to flip back and forth and generate those unusual redirect URLs.

Additional Context:
- The behavior is consistent and reproducible in the production environment
- Clean reproduction case works as expected
- Works fine with next-intl v3.11.3
- Looking for debugging strategies or known issues that might cause this

Thank you for your time and any suggestions you might have!

![image](https://github.com/user-attachments/assets/4de115a5-9a8c-494f-a5a1-cb0ce61ff3ec)
![image](https://github.com/user-attachments/assets/fadb2187-6d83-4ec4-bafb-d161ad905af6)

0 Replies