Skip to content

[Nextjs] withSentryConfig injects debugId despite source maps: { disabled: true } #15106

Closed
@digitalhank

Description

@digitalhank

Environment

self-hosted (https://develop.sentry.dev/self-hosted/)

Steps to Reproduce

using "@sentry/nextjs": "8.47.0", "@sentry/cli": "2.39.1", "@sentry/webpack-plugin": "2.22.7", "next": "14.1.4".

We are employing a micro frontend strategy with nextjs and module federation. As per your documentation on micro frontends, only host is using "@sentry/nextjs" w/ instrumentation while the remotes are using "@sentry/webpack-plugin" in the next.config in order to propagate errors to the appropriate micro frontend project.

Our CI pipeline is restrictive and stops us from uploading source maps to sentry in the same job we build the app docker image. This has lead me to separate the jobs like

Job 1 - Build the app with source maps and inject debug id using the sentry-cli sourcemaps inject. Pass source maps to job 2.
Job 2 - Upload source maps to sentry using sentry-cli source maps upload

Initially I was doing this with one of the remotes that uses sentry/webpack-plugin. Sentry was struggling to map the debug id in the uploaded artifact with the stack trace in the error event. I realized that during build, if we disable source maps in the next.config and let the cli tool do all the work, the debug id are correctly mapped.

    sentryWebpackPlugin({
      sourcemaps: {
        disable: true,
      },
      moduleMetadata: ({ release }) => ({
        dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
        release,
      }),
    }),

The problem: disabling source maps in withSentryConfig from @sentry/nextjs does not have the same effect. debug id are still injected which confuses the sentry engine because a single file can contain both the debug id injected during build and the one injected after build by the cli.

Edit - using "unstable_sentryWebpackPluginOptions" in "withSentryConfig" is a viable workaround

Expected Result

There should be no debug id reference in any file

Actual Result

files (like _app) contain debugid in one of the first lines

Product Area

Issues - Source Maps

Link

No response

DSN

No response

Version

24.8.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions