Open Reinano opened 1 year ago
The problem is the locales, probably the same as this. It looks like Vercel doesn't care about i18n
Agreed, there seemed to be an issue with localization in general when combining config rewrites with middleware as far as I've last noticed. But don't quote me on that
Btw, it's working fine in development, but fails in production build :(
Verify canary release
Provide environment information
Which area(s) of Next.js are affected? (leave empty if unsure)
Middleware / Edge (API routes, runtime), Routing (next/router, next/navigation, next/link)
Link to the code that reproduces this issue or a replay of the bug
https://github.com/Reinano/custom-next
To Reproduce
1.next build && next start 2.Go to main page then click any link (about-1 or about-2). 3.Check router.query.slug
Describe the Bug
I use rewrites and in the case when there is a middleware.ts file in the root of the project, then rewrites with a dynamic slug stop working. I have rewrites like this:
const nextConfig = { reactStrictMode: true, async rewrites() { return [ { source: '/es-es/(quenes-somos)/:slug', destination: '/about/:slug', locale: false, }, ] } }
If i go to production build and start it. Next dev is ok. After following the link<Link href='/es-es/quenes-somos/about-1'>about-1 </Link>
from the main page to the about/[slug] dynamic page, I won't get router.query.slug. If u reload the page u can get router.query.slug Router.query.slug available from getServerSideProps, but not in client side.Expected Behavior
Would like to have access to router.query.slug from useRouter()
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response