Rewrites with i18n causes TypeError: Expected "nextInternalLocale" to be a string
See original GitHub issueBug report
Describe the bug
Using rewrites in next.config.js together with following i18n
settings:
i18n: {
locales: ['en', 'de'],
defaultLocale: 'de',
localeDetection: false,
}
Rewrite example:
async rewrites() {
const rewrites = [
{
source: '/gssp-alternative',
destination: '/gssp',
},
];
return rewrites;
},
Navigating in browser from / to /gssp-alternative causes a client-side runtime error.
To Reproduce
https://repl.it/@berndartmueller/nextjs1003-nextInternalLocale-bug
- Click on “CLICK HERE TO SEE ERROR” link
- Error popup is shown with error
TypeError: Expected "nextInternalLocale" to be a string
Expected behavior
No error.
System information
- OS: macOS
- Browser: does not matter
- Version of Next.js: 10.0.3
- Version of Node.js: Don’t know, it’s repl.it 😄
- Deployment: next dev
Thanks a lot!
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Rewrites - next.config.js
rewrites is an async function that expects to return either an array or an object of arrays (see below) holding objects with source...
Read more >Problem finding string atached to json file when translating ...
When you are translating with i18n, and get this error, it could be because you have altered the translation JSON file and the...
Read more >i18n - npm
Lightweight simple translation module with dynamic JSON storage. Supports plain vanilla Node.js apps and should work with any framework (like ...
Read more >How to Localize a Svelte App with svelte-i18n | Phrase
Of course, if you use Svelte, you already know that it's a compiler, not a framework that ships with your production code. This...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Please add
locale: false
https://nextjs.org/docs/api-reference/next.config.js/rewrites#rewrites-with-i18n-support
I encounter the exact same error when using i18n Routing + Rewrites.
I already created a bug report (#19227) for another issue when I am using i18n Routing + Rewrites + Vercel Now.
But the attached demo repository (https://github.com/kivohin/i18n-routing-rewrites-vercel-now) in that bug report can be used to reproduce the mentioned error (
TypeError: Expected "nextInternalLocale" to be a string
).I still get it even when using the suggested
locale: false
option on Next.jsv10.0.3
.@berndartmueller, @MSefer