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/nextjs 8.40.0 Error require() of ES Module #14498

Open
3 tasks done
Jussinevavuori opened this issue Nov 27, 2024 · 1 comment
Open
3 tasks done

@sentry/nextjs 8.40.0 Error require() of ES Module #14498

Jussinevavuori opened this issue Nov 27, 2024 · 1 comment
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK

Comments

@Jussinevavuori
Copy link

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nextjs

SDK Version

8.40.0

Framework Version

Next 15.0.4-canary.28

Link to Sentry event

No response

Reproduction Example/SDK Setup

Any Next.js 15 + Sentry 8.40.0 template/basic application deployed to Vercel.

Steps to Reproduce

  1. npx create-next-app --example with-sentry nextjs-sentry-example
  2. Ensure [email protected] installed
  3. Build project locally (Build should pass)
  4. Deploy project to Vercel (Build should fail)
  5. Downgrade to [email protected]
  6. Deploy project to Vercel (Build should pass)

Expected Result

Build should pass in Vercel

Actual Result

unhandledRejection Error: require() of ES Module /vercel/path0/node_modules/chalk/source/index.js from /vercel/path0/node_modules/@sentry/nextjs/build/cjs/config/webpack.js not supported.
Instead change the require of index.js in /vercel/path0/node_modules/@sentry/nextjs/build/cjs/config/webpack.js to a dynamic import() which is available in all CommonJS modules.
    at mod.require (node_modules/next/dist/server/require-hook.js:65:28)
    at Object.<anonymous> (../../node_modules/@sentry/nextjs/build/cjs/config/webpack.js:12:15) {
  type: 'Error',
  code: 'ERR_REQUIRE_ESM'
}
error: script "build" exited with code 1
Error: Command "bun run build" exited with 1
@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Nov 27, 2024
@github-actions github-actions bot added the Package: nextjs Issues related to the Sentry Nextjs SDK label Nov 27, 2024
@chargome
Copy link
Member

hi @Jussinevavuori , npx create-next-app --example with-sentry creates an outdated setup based on v7, please make sure to either follow our guide for setting up v8 or our migration guide if you're coming from v7.

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
Projects
Status: No status
Development

No branches or pull requests

2 participants