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

Webpack 5, API functions and Vercel error #25431

Closed
marbiano opened this issue May 24, 2021 · 6 comments · Fixed by #28667
Closed

Webpack 5, API functions and Vercel error #25431

marbiano opened this issue May 24, 2021 · 6 comments · Fixed by #28667
Assignees
Milestone

Comments

@marbiano
Copy link
Contributor

marbiano commented May 24, 2021

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:

@marbiano marbiano added the bug Issue was opened via the bug report template. label May 24, 2021
@timneutkens timneutkens added kind: bug and removed bug Issue was opened via the bug report template. labels May 25, 2021
@timneutkens timneutkens added this to the Iteration 21 milestone May 25, 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
  }
}

@marbiano
Copy link
Contributor Author

I can confirm that it's working like charm in a standard setup! 🎉

Having said that, we are using Sentry default integration (via @sentry/nextjs) and the moment we update our next.config.js the way they suggest, Vercel builds start failing with the following error:

Screen Shot 2021-08-26 at 5 20 10 PM

Here's the modified config file in case it's useful for something.

Do you happen to know if the error is on Next.js or Sentry side?

@marbiano
Copy link
Contributor Author

I actually found this line of code in the mentioned PR that is using this.entryTraces.get. Should I report Sentry folks to do anything in a different way?

@ijjk
Copy link
Member

ijjk commented Aug 31, 2021

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

@marbiano
Copy link
Contributor Author

marbiano commented Sep 1, 2021

@ijjk works like charm, thanks so much!

@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
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants