Skip to content
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] API Route still return Internal Server Error when deployed to vercel, but works fine locally #26200

Closed
sozonome opened this issue Jun 16, 2021 · 3 comments
Labels
bug Issue was opened via the bug report template.

Comments

@sozonome
Copy link

sozonome commented Jun 16, 2021

What version of Next.js are you using?

11.0.0

What version of Node.js are you using?

14.15.3

What browser are you using?

Chrome

What operating system are you using?

Windows

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 after updating to Next 11 which has Webpack 5 enabled by default, the api route return ISE (Internal Server Error) when deployed to vercel. Previously I reported the same problem with a sample project here: #23894.

But I found out it still happen in my other project:
https://github.com/sozonome/sznm.dev/tree/update-next/11
https://sznm-dev-m9igy0ifj-sozonome.vercel.app/api/projects

If I disabled the webpack5, everything works fine
https://github.com/sozonome/sznm.dev/tree/update-next/11-wp5-disabled
https://sznm-dev-qqvhfi2jd-sozonome.vercel.app/api/projects

Expected Behavior

The api route should works fine locally and when being deployed.
should return like this:
(webpack5 disabled - next version 10.2) https://sznm.dev/api/projects
(webpack5 disabled - next version 11) https://sznm-dev-qqvhfi2jd-sozonome.vercel.app/api/projects

To Reproduce

The project repository which I tried to update to next 11 (not in the main branch):
https://github.com/sozonome/sznm.dev/tree/update-next/11

Deployed (Vercel) which return ISE (Internal Server Error):
https://sznm-dev-m9igy0ifj-sozonome.vercel.app/api/projects

@sozonome sozonome added the bug Issue was opened via the bug report template. label Jun 16, 2021
@ijjk ijjk mentioned this issue Jun 16, 2021
2 tasks
kodiakhq bot pushed a commit to timneutkens/next.js that referenced this issue Aug 16, 2021
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
@ijjk
Copy link
Member

ijjk commented Aug 25, 2021

Hi, this has been updated and can now be tested in v11.1.1-canary.14 of Next.js by adding the below config to your next.config.js and re-deploying. Please update and give it a try!

module.exports = {
  experimental: {
    nftTracing: true
  }
}

@sozonome
Copy link
Author

sozonome commented Aug 29, 2021

Hi, this has been updated and can now be tested in v11.1.1-canary.14 of Next.js by adding the below config to your next.config.js and re-deploying. Please update and give it a try!

module.exports = {
  experimental: {
    nftTracing: true
  }
}

Nice! @ijjk 🙏 It worked now. Will update to next11.1.1 stable when its out.

https://github.com/sozonome/sznm.dev/blob/next-11.1.1/nftTracing/next.config.js
https://sznm-dev-4ouv6wb2t-sozonome.vercel.app/api/projects

@balazsorban44
Copy link
Member

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.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

4 participants