Issue: Dynamic Routes in NextJS (v14.0.4) Yield 500 Error on Netlify Deployment
Details: In my NextJS application, all dynamic routes are encountering a 500 error post-deployment on Netlify. This issue doesn’t arise during local development or when deploying via Vercel.
Local Development:
npm run dev: Functions correctly on localhost.
netlify dev: No issues on localhost.
npm run build followed by npm run start: Simulates build process successfully on local environment.
Vercel Deployment: Fully operational with no errors.
Attempts to Resolve:
Examined and implemented solutions from other Netlify support queries, but to no avail.
Request: Any guidance or suggestions to fix this issue would be highly appreciated. Support
Next.js 14 doesn’t work well on Netlify at the moment and this would be resolved in v5 of the Next.js Runtime scheduled to release in this quarter (currently in beta).
Thanks for the update @hrishikesh . I attempted to revert my code to a point where dynamic routing was functioning correctly. This rollback occurred before the introduction of the Node module package known as “@elastic/elasticsearch.” I would like to request verification regarding whether certain packages may have caused the disruption in dynamic routing.
Interesting. The current error that you’re seeing on: staging.community.flockx.io, has nothing to do with Next.js compatibility. It’s a system-level issue. We are seeing the error:
Lambda was not able to unzip the file
Could you potentially try to re-deploy the site to see if it works?
I tried to redeploy it multiple times, but still getting same issue. Can you please share more info @hrishikesh . Is it particular package issue or nextjs issue or netlify issue?
This is related to PNPM: .npmrc | pnpm. The official doc is even mentioning that this is needed for serverless:
Your project is deployed to a serverless hosting provider. Some serverless providers (for instance, AWS Lambda) don’t support symlinks. An alternative solution for this problem is to bundle your application before deployment.