question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Webpack 5, API functions and Vercel error

See original GitHub issue

What 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? Screen Shot 2021-05-22 at 12 00 20 AM

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:

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
ijjkcommented, Aug 31, 2021

@marbiano I opened a PR here which should address the above issue, thanks for the reproduction!

2reactions
ijjkcommented, 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
  }
}
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found