Open dmgawel opened 1 year ago
Is this issue fixed? I am getting this error in next@14.0.4
Error occurred prerendering page "/de/feature/chatgpt-for-twitter". Read more: https://nextjs.org/docs/messages/prerender-error -- Error: The provided export path '/feature/chatgpt-for-twitter' doesn't match the '/[lang]/feature/[feature]' page.This occured after adding i18n property to next.config.js like this:
...
i18n: {
locales: allLocales,
defaultLocale: "en",
},
...
I was trying to fix my rewrites as stated here: https://nextjs.org/docs/app/api-reference/next-config-js/rewrites#rewrites-with-i18n-support
I'm getting this in next15. Any workarounds?
Verify canary release
Provide environment information
Which area(s) of Next.js are affected? (leave empty if unsure)
App directory (appDir: true), Internationalization (i18n)
Link to the code that reproduces this issue
https://codesandbox.io/p/sandbox/next-13-2-i18n-static-params-error-3swobx
To Reproduce
app/
directory with language routing and dynamic segment, e.g.app/[lang]/blog/[slug]/page.tsx
generateStaticParams
with sample slugs and specifiec locale (e.g.'en'
)next.config.js
, defaultLocale and locales is enough. defaultLocale should have the same value as used ingenerateStaticParams
next build
and observe error:Describe the Bug
Having locales and defaultLocale specified in config file breaks
generateStaticParams
functionality when running production build. It seems like the default locale is stripped from page path, causing the export path not match the pattern.Expected Behavior
Build should run smoothly (without removing i18n config from config file, wchich may be needed for
pages/
directory), allapp/
pages withgenerateStaticParams
should be prerendered.Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
NEXT-979