Skip to content

fix(nestjs): Register SentryTracingInterceptor only once - #26775

Open
chargome wants to merge 1 commit into
developfrom
fix/nestjs-duplicate-tracing-interceptor
Open

chargome wants to merge 1 commit into
developfrom
fix/nestjs-duplicate-tracing-interceptor

Conversation

@chargome

@chargome chargome commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

What

SentryModule.forRoot() no longer registers SentryTracingInterceptor a second time, so it runs once per request instead of twice.

Why

The interceptor is already a provider in the static @Module() metadata, and Nest merges that with what forRoot() returns. Split out from #26768 since it affects all apps.

SentryModule lists the interceptor as an APP_INTERCEPTOR provider in both its
static @module() metadata and forRoot(). Nest merges the two, so apps importing
SentryModule.forRoot() got two interceptor instances and ran every request
through both. Drop the provider from forRoot().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chargome chargome self-assigned this Nov 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: bd6482a (PR test merge using develop at 24e885e)

Against: 24e885e (develop) · base run #67586

✅ Baseline matches: this diff contains only this PR's changes.

Path Size % Change Change
@sentry/browser 30.34 kB - -
@sentry/browser - with treeshaking flags 28.52 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 28.4 kB - -
@sentry/browser (incl. Tracing) 52.97 kB - -
@sentry/browser (incl. Tracing Core) 40.39 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 52.97 kB - -
@sentry/browser (incl. Tracing, Profiling) 55.83 kB - -
@sentry/browser (incl. Tracing, Replay) 93.02 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 81.86 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 97.36 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 110.96 kB - -
@sentry/browser (incl. Feedback) 48.31 kB - -
@sentry/browser (incl. sendFeedback) 30.91 kB - -
@sentry/browser (incl. FeedbackAsync) 35.96 kB - -
@sentry/browser (incl. Metrics) 31.66 kB - -
@sentry/browser (incl. Logs) 31.94 kB - -
@sentry/browser (incl. Metrics & Logs) 32.59 kB - -
@sentry/react 32.36 kB - -
@sentry/react (incl. Tracing) 55.57 kB - -
@sentry/vue 38.53 kB - -
@sentry/vue (incl. Tracing) 55.91 kB - -
@sentry/svelte 30.36 kB - -
@sentry/effect (client) 42.02 kB - -
@sentry/effect (client, incl. Tracing) 49.17 kB - -
@sentry/effect (client, incl. Tracing, Logs, Metrics) 59.08 kB - -
@sentry/remix (Remix 3 client bundle) 58.61 kB - -
CDN Bundle 32.25 kB - -
CDN Bundle (incl. Tracing) 53.37 kB - -
CDN Bundle (incl. Logs, Metrics) 35.04 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 55.91 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 76.11 kB - -
CDN Bundle (incl. Tracing, Replay) 91.26 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 93.88 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 96.69 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 99.24 kB - -
CDN Bundle - uncompressed 94.2 kB - -
CDN Bundle (incl. Tracing) - uncompressed 157.8 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 102.54 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 165.43 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 232.78 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 278.07 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 285.7 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 290 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 297.62 kB - -
@sentry/nextjs (client) 59.34 kB - -
@sentry/sveltekit (client) 54.25 kB - -
@sentry/core/server 45.81 kB - -
@sentry/core/browser 14.41 kB - -
@sentry/node 156.02 kB - -
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.46 kB - -
@sentry/node - without tracing 89.04 kB -0.01% -6 B 🔽
@sentry/node - without channel injection 144.95 kB - -
@sentry/aws-serverless 99.72 kB -0.01% -6 B 🔽
@sentry/cloudflare (withSentry) - minified 209.4 kB - -
@sentry/cloudflare (withSentry) 486.21 kB - -
@sentry/cloudflare (withSentry, instrumented CommonJS package) - minified 212.34 kB - -
@sentry/nextjs/cloudflare (withSentry) - minified 234.63 kB - -

View base workflow run

@github-actions

Copy link
Copy Markdown
Contributor

Optional E2E tests

All optional checks were successful. 3 successful. See the run.

Successful checks
Check Status
✅ CI: Optional E2E Tests / E2E nestjs-12 (cloudflare) Test (optional) Successful in 29s Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (deno) Test (optional) Successful in 55s Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (bun) Test (optional) Successful in 50s Details

@chargome

Copy link
Copy Markdown
Member Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit c5c1dbe. Configure here.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant