Webpack 5, API functions and Vercel error
See original GitHub issueWhat version of Next.js are you using?
10.2.2
What version of Node.js are you using?
14
What browser are you using?
Chrome
What operating system are you using?
macOS
How are you deploying your application?
Vercel
Describe the Bug
What is happening? As soon as we enable webpack5, some of our endpoints break.
Which endpoints?
Those that share using a function that uses fs.readFile
. If it’s a single endpoint using that function, it works just fine. As soon as we add a second endpoint, they both break.
What’s the error?
Where does this happen>?
This only happens on Vercel, it works fine locally while doing next build && next start
.
Expected Behavior
We should be able to enable webpack5 and not have endpoints breaking under the description listed above.
To Reproduce
Check it out this repo. Here are the two endpoints sharing a single external function.
Also, we have Vercel deployments to verify:
- Here’s a deployment with a single endpoint where everything works just fine.
- Here’s a deployment with an extra endpoint where they break.
- Here’s the diff between those two deployments, in order to fully verify the issue.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Errors – Vercel Docs
A list of errors provided by Vercel CLI or the REST API, with details on how they occur and how to resolve them....
Read more >Upgrade Guide
This new parser has improved handling of CSS and now errors when invalid CSS is used ... As communicated in the webpack 5...
Read more >I am getting errors when deploying to Vercel. Can anyone ...
Done in 47.72s. Detected Next.js version: 11.1.3. Running "yarn run build". yarn run v1.22.17. $ next build. info - Using webpack 5. Reason ......
Read more >webpack
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >Netlify Build Deployment Error because of Webpack
Site Name: MMODoctor Framework: NextJS Application Error: Webpack Build Error ... is considered Legacy. new code should use the URLSearchParams API instead.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@marbiano I opened a PR here which should address the above issue, thanks for the reproduction!
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 yournext.config.js
and re-deploying. Please update and give it a try!