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

@sentry/next.js and @sentry/cli failing after Next.js 12.2.0 upgrade #5366

Closed
3 tasks done
heldr opened this issue Jul 5, 2022 · 5 comments
Closed
3 tasks done

@sentry/next.js and @sentry/cli failing after Next.js 12.2.0 upgrade #5366

heldr opened this issue Jul 5, 2022 · 5 comments
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK Type: Bug

Comments

@heldr
Copy link

heldr commented Jul 5, 2022

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/nextjs

SDK Version

7.5.0

Framework Version

7.5.0

Link to Sentry event

No response

Steps to Reproduce

After upgrading to Next.js 12.2.0, webpack plugin withSentryConfig seems to fail when CLI tries to update and upload source maps.

Expected Result

CLI is expected to recognize Node.js modules.

Actual Result

Getting this error
CleanShot 2022-07-05 at 11 28 37

even if all those modules are already skipped on non-server builds.
CleanShot 2022-07-05 at 11 33 27

@heldr heldr added the Type: Bug label Jul 5, 2022
@heldr heldr changed the title Next.js 12.2.0 build started failing @sentry/next.js and @sentry/cli failing after Next.js 12.2.0 upgrade Jul 5, 2022
@AbhiPrasad
Copy link
Member

Hey thanks for writing in, we are taking a look! In the mean time, to help us debug, could you provide your webpack version and your next.config.js if possible? A repro app of some sort will also help a lot!

I have a quick theory that https://nextjs.org/docs/api-reference/edge-runtime is causing issues here. As per their section on unsupported APIs:

Native Node.js APIs are not supported. For example, you can't read or write to the filesystem

Not sure why they would be running at build time though, so maybe I'm wrong 🤔.

@AbhiPrasad AbhiPrasad added Status: Needs Reproduction Package: nextjs Issues related to the Sentry Nextjs SDK labels Jul 5, 2022
@heldr
Copy link
Author

heldr commented Jul 5, 2022

@AbhiPrasad you are actually right!

I just setup one codesandbox example where commenting the following edge api runtime avoids the issue.

export const config = {
  runtime: 'experimental-edge'
};

I'm going to ignore those edge functions on Sentry config on meantime.

how to debug sandbox

Edge api function example.
https://codesandbox.io/s/headless-sun-xqrqgj?file=/pages/api/geoip.js

please set the following env var secrets:

SENTRY_ORG
SENTRY_PROJECT
SENTRY_AUTH_TOKEN
NEXT_PUBLIC_SENTRY_DSN

then open a new terminal and run

yarn build

@AbhiPrasad
Copy link
Member

See vercel/next.js#36776 for more details. Yeah we don't support middleware at the moment, this is being tracked here: #4206

@heldr
Copy link
Author

heldr commented Jul 5, 2022

Apparently adding edge route api to ignoreFile and ignore array CLI config doesn't avoid issue.

@heldr
Copy link
Author

heldr commented Jul 8, 2022

Bug reported was fixed on Next.js 12.2.1 by this changed vercel/next.js#38234

@heldr heldr closed this as completed Jul 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK Type: Bug
Projects
None yet
Development

No branches or pull requests

2 participants