sentry-javascript: Sentry.init no longer being called after sdk upgrade

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.58.0

Framework Version

Nextjs 13.0.6

Link to Sentry event

No response

SDK Setup

import * as Sentry from '@sentry/nextjs';
import prisma from 'lib/server/prisma';

const SENTRY_DSN = process.env.SENTRY_DSN;

Sentry.init({
  dsn:
    SENTRY_DSN,
  enabled: process.env.NODE_ENV === 'production',
  environment: process.env.NEXT_PUBLIC_ENVIRONMENT_NAME,
  ignoreErrors: [
    // See: https://stackoverflow.com/questions/55738408/javascript-typeerror-cancelled-error-when-calling-fetch-on-ios
    'TypeError: cancelled',
    'AbortError: The user aborted a request.',
    'AbortError: Fetch is aborted',
    'Relay: Missing @required value',
    // Special cased in the UI to show a refresh button.
    'GraphQL operations must contain a non-empty `query` or a `persistedQuery` extension.',
    'This Suspense boundary received an update before it finished hydrating.',
    // These errors are thrown when the user needs to re-authenticate their MS account.
    'The provided grant has expired due to it being revoked, a fresh auth token is needed. The user might have changed or reset their password.',
    /^User's email .+ does not match Microsoft username .+$/,
  ],
  denyUrls: [
    // See: https://stackoverflow.com/questions/67224859/typeerror-illegal-invocation
    'googletagmanager.com',
  ],
  tracesSampler: (samplingContext) => {
    if (samplingContext.transactionContext.name.includes('ingr3ss')) {
      return 0;
    }

    return process.env.NEXT_PUBLIC_ENVIRONMENT_NAME === 'staging' ? 1 : 0.25;
  },
  integrations: [new Sentry.Integrations.Prisma({ client: prisma })],
});

Steps to Reproduce

  1. From sentry/nextjs v7.56.0 upgrade to v7.57.0 or later
  2. Sentry.init is no longer being called automatically on startup

Expected Result

  1. From sentry/nextjs v7.56.0 upgrade to v7.57.0 or later
  2. Sentry works normally after upgrade

Actual Result

After upgrading the sdk following logs appear when errors are captured and we don’t see the file with the sentry.init call being loaded at all. We noticed all server-side errors were no longer captured after the sdk upgrade. We think it started occuring after this change, https://github.com/getsentry/sentry-javascript/pull/8368 Happy to help repro this, we reached out to sentry support but they told us to file a GH issue.

Tracing extension 'startTransaction' has not been added. Call 'addTracingExtensions' before calling 'init':
Sentry.addTracingExtensions();
Sentry.init({...});

Tracing extension 'startTransaction' has not been added. Call 'addTracingExtensions' before calling 'init':
Sentry.addTracingExtensions();
Sentry.init({...});

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 2
  • Comments: 16 (10 by maintainers)

Most upvoted comments

@lforst any idea what this could be?

No idea. I would try upgrading to the newest SDK version and if the issue persists provide a small reproduction example.

Hey @AbhiPrasad we are not running on vercel. We are using Google cloud run, so a server environment not any edge runtime. We are using a custom server in next js, but that wasn’t an issue before.