-
Notifications
You must be signed in to change notification settings - Fork 27.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Webpack5 enabled API Route return Internal Server Error when deployed to vercel, but works fine locally #23894
Comments
@sozonome are you using i18n? I realized all my API routes on Vercel are now prepended with the locales and not available any longer as they used before. This results on all my API functions to result in 404 |
Nope, I didn't use / configure i18n, you can check the repo I attached. My case only happened when I enable webpack5 and the internal server error only occurs in production deployment using vercel. |
@sozonome maybe we both don't have the same issue, but maybe open the deployment on Vercel and see inside of function if your function call is present. I just realized that on Vercel all my calls are prefixed with [locale] which leads online to all API calls to fail. |
@sozonome yes I agree has nothing to do with i18n. I stripped it all down, the error only occurs in my Vercel deployements with webpack5 enabled, if I disable it and re-deploy the API routes are working again. |
We've landed a patch for this and it should be available soon, will update here when it is! |
The above mentioned patch is now available, please re-deploy your application and give it a try! |
This adds tracing entrypoints directly after they have have been transpiled to allow us to trace before the webpack runtime has been added to the modules. This should allow for more accurate tracing of entrypoints and allow the trace step to be cached. ## Bug - [x] Related issues linked using `fixes #number` - [x] Integration tests added x-ref: vercel#24700 x-ref: vercel#26200 x-ref: vercel#23894 x-ref: vercel#25431
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
What version of Next.js are you using?
10.1.3
What version of Node.js are you using?
14.15.3
What browser are you using?
Chrome
What operating system are you using?
Windows 10
How are you deploying your application?
Vercel
Describe the Bug
I have a project which have an API route which returns collection of data from markdowns using
gray-matter
. Works fine locally and when deployed to vercel. But problem occurs when I enable the webpack5 configuration innext.config.js
, now the api route works fine locally, but it returns ISE (Internal Server Error) when deployed to vercel.Expected Behavior
The api route should works fine locally and when being deployed to vercel with webpack5 enabled.
To Reproduce
Sample Repository to reproduce: https://github.com/sozonome/nextjs-webpack5-api-route-vercel-deployment-error
https://github.com/sozonome/nextjs-webpack5-api-route-vercel-deployment-error/blob/main/next.config.js
Expected (local dev screenshot):
Deployed (in vercel):
https://nextjs-webpack5-api-route-vercel-deployment-error.vercel.app/api/posts
The text was updated successfully, but these errors were encountered: