Skip to content

@sentry/nextjs doesn't respect sourcemaps.filesToDeleteAfterUpload #8600

Closed
@joeldotsh

Description

@joeldotsh

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

7.59.3

Framework Version

Next 13.4.9 / React 18.2.0

Link to Sentry event

No response

SDK Setup

Sentry.init({
  dsn: ...,
  tracesSampleRate: 1.0
});

Then in my next.config.js:

const nextConfig = {
  ...
}

const sentryWebpackPluginOptions = {
  org: ...,
  project: ...,
  authToken: ...,
  sourcemaps: {
    filesToDeleteAfterUpload: "*.map" // Also tried "**/*.map", ".next/**/*.map", even ".next/*"
  }
};

module.exports = withSentryConfig(nextConfig, sentryWebpackPluginOptions)

Steps to Reproduce

  1. Add the above config to next.config.js
  2. Run next build
  3. Observe sourcemaps are still present in the .next outputs

Expected Result

Expected sourcemaps in the .next outputs to have sourcemaps removed.

According to the docs, the package uses @sentry/webpack-plugin under the hood, which has a sourcemaps.filesToDeleteAfterUpload configuration option. But I wasn't able to get this working (see above next.config.js attempts).

Actual Result

Sourcemaps are still present in the .next outputs.

It appears the filesToDeleteAfterUpload option isn't being respected, or I'm botching the config? If I'm looking at this correctly, the package uses an old version of the webpack plugin, which doesn't support that option. Is that the case? Would it be safe to upgrade this manually and set a yarn resolution? What is the recommended approach here?

Thank you

Metadata

Metadata

Assignees

Labels

Package: nextjsIssues related to the Sentry Nextjs SDK

Type

No type

Projects

Status

Waiting for: Product Owner

Status

Waiting for: Community

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions