Skip to content

@sentry/nextjs v11: tracing modules bundle even with tracesSampleRate: 0 — the default-integration import graph is static #24795

Description

@goranpopo

Environment

@sentry/nextjs 11.0.0, Next 16.3.6 + Turbopack production build, tracesSampleRate: 0, explicit integrations: [rewriteFramesIntegration, thirdPartyErrorFilterIntegration].

What are you trying to achieve?

An error-only client SDK: performance tracing is off (tracesSampleRate: 0, no browserTracingIntegration registered), so the tracing machinery should not reach the bundle.

What happens instead?

The tracing stack still bundles. Measured from Turbopack's build analysis of a 47-route app, all present in every route's client chunks:

  • browserTracingIntegration.js (@sentry/browser)
  • tracing/sentrySpan.js, tracing/trace.js, tracing/idleSpan.js, spanUtils.js (@sentry/core)
  • browser-utils/spans.js, request.js, fetch.js, appRouterRoutingInstrumentation.js (@sentry/nextjs)

Together ~30-40 kB gz per route. The modules arrive through the default-integration set that init wires statically, so passing an explicit integrations list does not remove them from the import graph — the filter runs after the imports.

Suggestion

When tracesSampleRate: 0 (and no tracesSampler), build the default integration list without the tracing family — statically, not at runtime — the same way the SDK already treats disabled features elsewhere. For an error-only app that is the single largest remaining dependency after react-dom.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions