Skip to content

Stacktraces not source mapped after upgrading from 7.26 to 7.42 (Next.js assetPrefix) #7500

Closed
@eirikur-grid

Description

@eirikur-grid

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using? If you use the CDN bundles, please specify the exact bundle (e.g. bundle.tracing.min.js) in your SDK setup.

@sentry/nextjs

SDK Version

7.42.0

Framework Version

Next.js 12.3.2

Link to Sentry event

https://grid.sentry.io/issues/3671197832/events/004e5ad1ed91484f92e601c6c5f13b83/?project=1871088

SDK Setup

Client config

Sentry.init({
  enabled: isEnabled,
  dsn: SENTRY_DSN,
  environment: SENTRY_ENV,
  release: BUILD_ID,
  ignoreErrors,
  beforeSend: event => {
    const { type, title, contexts } = event;
    if (type === 'error' &&
          /^(?:iPhone|Mac|iPad)$/.test(contexts?.device?.family || '') &&
          (
            /^TypeError: (?:cancelled|geannuleerd|cancelado|annulleret|avbrutt|avbruten|Abgebrochen)$/i.test(title || '')
          )) {
      return null;
    }

    integrateWithFullstory(event);
    return event;
  },
  integrations:  [
    new Integrations.BrowserTracing({
      tracingOrigins: [ getApiHost() ],
      beforeNavigate: context => {
        const dynamicRouteName = mapSlugToRoute(window.location.pathname);
        if (dynamicRouteName) {
          return {
            ...context, name: dynamicRouteName,
          };
        }
        return context;
      },
    }),
  ]
    .filter(Boolean),
  tracesSampler: samplingRate,
});

Server config

import * as Sentry from '@sentry/nextjs';
Sentry.init({
  enabled: process.env.NODE_ENV === 'production',
  environment: SENTRY_ENV,
  dsn: SENTRY_DSN,
  release: BUILD_ID,
  tracesSampleRate: 0,
});

Steps to Reproduce

We recently updated the following sentry packages from version 7.26 to 7.42:

  • @sentry/nextjs
  • @sentry/tracing
  • @sentry/utils

We have a Next.js application that has an asset prefix defined as /_client
The sourcemaps are uploaded to Sentry at build time from CircleCI. The source maps are not included in the docker image that we then later deploy.

Expected Result

Stack traces show original, unminified JavaScript/TypeScript code.

Actual Result

Stack traces show minified code.

Using the sentry-cli tool to investigate, it appears as if the assetPrefix is causing a mismatch.
Screenshot 2023-03-16 at 17 03 07

We have downgraded back to 7.26 and can verify that source maps are working again after doing so.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: nextjsIssues related to the Sentry Nextjs SDK

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions