Skip to content

Setting sourcemaps.disable to true results in compile errors of dependencies in node_modules #18983

Description

@Tadimsky

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

10.36.0

Framework Version

Next 16.1.5

Link to Sentry event

No response

Reproduction Example/SDK Setup

https://github.com/Tadimsky/sentry-issue-debugIds

Steps to Reproduce

Run:

  • yarn install
  • next build
  • next build

Expected Result

The second build to complete successfully.

Actual Result

The Sentry debugId injection is persisted to the files in node_modules and causes the build to fail:

./node_modules/apollo-upload-client/createUploadLink.mjs:302:2
Type error: An expression of type 'void' cannot be tested for truthiness.

  300 |  *   the extractable file matcher extracts.
  301 |  */
> 302 | !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="cfac0905-0a13-5f87-8f3f-4c32b28fa961")}catch(e){}}();
      |  ^
  303 | //# debugId=cfac0905-0a13-5f87-8f3f-4c32b28fa961
  304 |
Next.js build worker exited with code: 1 and signal: null

Additional Context

We're disabling the sourcemap functionality in local development but when we do this, we now get the debugId injection appending to files in node_modules after the first build.

This causes a compile-time error, so we cannot run tsc or next build again. This happens both locally and in CI (which is worse as our node_modules get cached).
For some reason, these files are being mutated?

Priority

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions