Dynamic page slugs return incorrect parameters in production on Vercel #66520
Unanswered
rnnyrk
asked this question in
App Router
Replies: 1 comment
-
|
I'm having the same issue in Next 14.2.5, and only on Vercel, on Node 20. This works correctly in dev and local builds. In an intercepting route, I'm defining a dynamic parameter like Side note: I'm only using |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
After deploying my project to Vercel, I'm encountering an issue where dynamic page slugs, following the pattern
app/[site]/[locale]/layout.tsx, are not behaving as expected. Instead of returning the rewritten parameters, they return[site]and[locale]. This problem only manifests in the production environment on Vercel; it does not occur in either local development or local production builds, which function correctly, therefore it's really hard to reproduce or make an Codesandbox op something similar.We have middleware rewriting the incoming url the the param structure. So
/ticketswill be rewritten to/sitename/nl/tickets, as you can see in the attached image this is happening correctly (as said locally everything works fine in dev/prod, only on Vercel it breaks). The middl4ware code rewriting the url:So an incoming request for /tickets is rewritten to /[site]/[locale]/tickets using middleware. This is because we are using a monorepository serving multiple sites from one codebase.
The rewriting of the url with the correct params is happening correctly on localhost in both development and production builds, but is breaking after deploying to Vercel. After deployment app/[site]/[locale]/layout.tsx doesn't receive the params: {site, locale} as e.g. site = 'sitename' and locale = 'nl' but rather site = [site] and locale = [locale]. So the params are not being rewritten.
This is only happening on Vercel for the files/routes resulting in a 500:
On the following routes we have no issue on Vercel and the params are being rewritten as expected:
We also use pages and app directory alongside each other because we are slowly migrating the project over to app directory. We spend multiple days debugging and trying to fix the issue without any success. Hopefully anyone can point us towards why it doesn't work on specifically Vercel deployment or how we might be able to reproduce it local.
Thans in advance. If there is any more information needed we are happy to supply any.
Beta Was this translation helpful? Give feedback.
All reactions