Skip to content

Source maps are renamed after deploy  #12375

@alex-crudu

Description

@alex-crudu

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/browser

SDK Version

8.7.0

Framework Version

Next 14.1.0

Link to Sentry event

https://datadirects.sentry.io/issues/5423182343/?project=4506767086190592&query=is%3Aunresolved&referrer=issue-stream&statsPeriod=30d&stream_index=1

SDK Setup

import * as Sentry from '@sentry/nextjs'

Sentry.init({
dsn: '.....',
debug: false,
tracesSampleRate: 0,
replaysOnErrorSampleRate: 0,
replaysSessionSampleRate: 0,
environment: process.env.NEXT_PUBLIC_SENTRY_ENV,
})

Steps to Reproduce

After updating Sentry to v8.2.1 I am deploying the project and my sourcemaps started to have names that are different than my build artefacts names and i get this error:
image

Example of a build prior to update
image

Example of build after update:
image

here's my next.config.js

const withNextIntl = require('next-intl/plugin')()
const withBundleAnalyzer = require('@next/bundle-analyzer')({
  enabled: process.env.ANALYZE === 'true',
})

const buildId = Date.now().toString()
console.log('BUILD ID:', buildId)

const config = {
  generateBuildId: () => buildId,
  output: 'standalone',
  reactStrictMode: true,
  productionBrowserSourceMaps: true,
  images: {
    remotePatterns: [
      {
        protocol: 'https',
        hostname: '**',
      },
    ],
  },
  webpack(config) {
    const fileLoaderRule = config.module.rules.find((rule) =>
      rule.test?.test?.('.svg')
    )

    config.module.rules.push(
      {
        ...fileLoaderRule,
        test: /\.svg$/i,
        resourceQuery: /url/, // *.svg?url
      },
      {
        test: /\.svg$/i,
        issuer: fileLoaderRule.issuer,
        resourceQuery: { not: [...fileLoaderRule.resourceQuery.not, /url/] }, // exclude if *.svg?url
        use: ['@svgr/webpack'],
      }
    )

    fileLoaderRule.exclude = /\.svg$/i

    // // Ignore opentelemetry warnings
    // if (isServer) {
    //   config.ignoreWarnings = [{ module: /opentelemetry/ }]
    // }

    return config
  },
}

module.exports = withBundleAnalyzer(withNextIntl(config))

const { withSentryConfig } = require('@sentry/nextjs')

if (process.env.NEXT_PUBLIC_SENTRY_ENV === 'prod') {
  module.exports = withSentryConfig(
    module.exports,
    {
      silent: true,
      org: '***',
      project: '***',
    },
    {
      widenClientFileUpload: true,
      transpileClientSDK: true,
      hideSourceMaps: true,
      disableLogger: true,
      automaticVercelMonitors: true,
    }
  )
}

Note, that i added buildId after i updated Sentry, so i am not sure if it might have caused the issue

Expected Result

To have the names matching

Actual Result

Artefact names are renamed and artefacts are not linked.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: nextjsIssues related to the Sentry Nextjs SDK

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions