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

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

Open
digitalhank opened this issue Dec 31, 2024 · 1 comment

Comments

@digitalhank
Copy link

digitalhank commented Dec 31, 2024

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

@getsantry
Copy link

getsantry bot commented Dec 31, 2024

Assigning to @getsentry/support for routing ⏲️

@dalnoki dalnoki transferred this issue from getsentry/sentry Jan 2, 2025
@getsantry getsantry bot moved this from Waiting for: Support to Waiting for: Product Owner in GitHub Issues with 👀 3 Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Waiting for: Product Owner
Status: No status
Development

No branches or pull requests

1 participant