Skip to content

feat(nuxt)!: Bundle server config into Nitro build - #24094

Open
s1gr1d wants to merge 9 commits into
developfrom
sig/nuxt-server-config-auto-add
Open

feat(nuxt)!: Bundle server config into Nitro build#24094
s1gr1d wants to merge 9 commits into
developfrom
sig/nuxt-server-config-auto-add

Conversation

@s1gr1d

@s1gr1d s1gr1d commented Sep 4, 2026

Copy link
Copy Markdown
Member

Previously, the sentry.server.config.ts file was emitted in the build output so it can be added with --import. As we don't rely on early-importing anymore (thanks to orchestrion), we don't need this file anymore.

  • Nitro plugin init (default): The server config is now bundled into the Nitro build and imported by a generated nitro plugin, so Sentry.init runs at startup without node --import. Works on Nitro 2 and 3, prod and dev (hurray)
  • --import compat: The old file path now gets a shim that just prints "remove this flag". A CI variant runs the whole suite with the shim preloaded to see if the warning is printed
  • Double init guard: A preload that really calls init wins. The bundled init skips with a notice.
  • Prerender: Init is skipped during prerendering, so CI builds send nothing. Tests assert no trace meta tags in prerendered HTML.
  • Early-crash tests: Errors thrown before listen are captured and flushed (first and last plugin slot)
  • Deprecated: both autoInjectServerSentry modes, kept working until v12

@s1gr1d
s1gr1d requested a review from a team as a code owner September 4, 2026 13:11
@s1gr1d
s1gr1d requested review from chargome and mydea and removed request for a team September 4, 2026 13:11
@s1gr1d

s1gr1d commented Sep 4, 2026

Copy link
Copy Markdown
Member Author

bugbot run

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 28.69 kB added added
@sentry/browser - with treeshaking flags 26.99 kB added added
@sentry/browser - with treeshaking flags tracing without tracing 26.89 kB added added
@sentry/browser (incl. Tracing) 49.07 kB added added
@sentry/browser (incl. Tracing + Span Streaming) 49.07 kB added added
@sentry/browser (incl. Tracing, Profiling) 51.98 kB added added
@sentry/browser (incl. Tracing, Replay) 88.62 kB added added
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.85 kB added added
@sentry/browser (incl. Tracing, Replay with Canvas) 93.3 kB added added
@sentry/browser (incl. Tracing, Replay, Feedback) 106.24 kB added added
@sentry/browser (incl. Feedback) 46.17 kB added added
@sentry/browser (incl. sendFeedback) 33.75 kB added added
@sentry/browser (incl. FeedbackAsync) 38.85 kB added added
@sentry/browser (incl. Metrics) 29.66 kB added added
@sentry/browser (incl. Logs) 29.94 kB added added
@sentry/browser (incl. Metrics & Logs) 30.59 kB added added
@sentry/react 30.45 kB added added
@sentry/react (incl. Tracing) 51.28 kB added added
@sentry/vue 35.91 kB added added
@sentry/vue (incl. Tracing) 51.34 kB added added
@sentry/svelte 28.71 kB added added
CDN Bundle 30.43 kB added added
CDN Bundle (incl. Tracing) 49.6 kB added added
CDN Bundle (incl. Logs, Metrics) 32.66 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) 51.53 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) 73.31 kB added added
CDN Bundle (incl. Tracing, Replay) 87.15 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 89.02 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) 93.08 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 95.03 kB added added
CDN Bundle - uncompressed 90.13 kB added added
CDN Bundle (incl. Tracing) - uncompressed 147.81 kB added added
CDN Bundle (incl. Logs, Metrics) - uncompressed 96.52 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 153.59 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 225.82 kB added added
CDN Bundle (incl. Tracing, Replay) - uncompressed 267.44 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 273.21 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 281.15 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 286.9 kB added added
@sentry/nextjs (client) 53.89 kB added added
@sentry/sveltekit (client) 49.51 kB added added
@sentry/core/server 40.96 kB added added
@sentry/core/browser 13.53 kB added added
@sentry/node 124.76 kB added added
@sentry/node/import (ESM hook with diagnostics-channel injection) 81.51 kB added added
@sentry/node - without tracing 88.5 kB added added
@sentry/node - without channel injection 104.08 kB added added
@sentry/aws-serverless 96.87 kB added added
@sentry/cloudflare (withSentry) - minified 201.56 kB added added
@sentry/cloudflare (withSentry) 501.37 kB added added

View base workflow 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.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 830a18a. Configure here.

);
});
return;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cloudflare filter misses inferred presets

Medium Severity

The Cloudflare skip only looks at nitroConfig.preset during nitro:config. Nitro often fills that in later from CF_PAGES, NITRO_PRESET, or similar, so a leftover sentry.server.config.ts can still be bundled into the worker as the Node SDK. The close-hook shim later sees the resolved preset and correctly skips, which makes the earlier filter miss more likely.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 830a18a. Configure here.


expect(prerenderedPage).not.toContain('sentry-trace');
expect(prerenderedPage).not.toContain('baggage');
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Prerender test does not prove skip

Low Severity

The prerender test treats missing sentry-trace and baggage tags as proof that bundled Sentry.init is skipped at build time. Those tags are already omitted for responses with the x-nitro-prerender header, so the assertion can pass even when init still runs and send events during CI builds.

Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit 830a18a. Configure here.

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