Skip to content

fix(nuxt): Ignore build output and public file spans with span streaming - #26781

Merged
s1gr1d merged 9 commits into
developfrom
sig/nuxt-build-artifacts
Nov 24, 2026
Merged

s1gr1d merged 9 commits into
developfrom
sig/nuxt-build-artifacts

Conversation

@s1gr1d

@s1gr1d s1gr1d commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

What

With span streaming (the default), the Nuxt SDK sent spans for Nuxt's own build files, and the browser's build manifest fetch could make pageloads longer. It also sent spans for files in public/ that the HTTP integration does not know as static files. Now the SDK ignores all of these in both trace modes, and it keeps real routes that only look like files.

Request Before, span streaming (default) Before, traceLifecycle: 'static' Now, both modes
Common static files, for example /_nuxt/entry.js, CSS, images, /favicon.ico not sent not sent not sent
Other build files on the server, for example /_nuxt/entry.js.map, /_nuxt/builds/latest.json sent not sent not sent
Build manifest fetch in the browser (/_nuxt/builds/meta/<id>.json) sent, makes the pageload longer sometimes sent, makes the pageload longer not sent
Routes that look like files, for example /api/data.json sent not sent (bug) sent
Other files in public/, for example .pdf, .txt, .webmanifest sent not sent not sent

Bold marks the problems this PR fixes.

The filters read app.baseURL and app.buildAssetsDir, so custom build folders and base paths work too. The browser filter matches only the app's own origin, or app.cdnURL if it is set, so requests to other hosts keep their spans.

Why

The old filter was an event processor that dropped transactions by name. Event processors do not run with span streaming, so the filter silently stopped working. Now the SDK adds ignoreSpans defaults instead, which work in both modes.

The new server filter matches only paths that start with the build folder, not every path with a file extension. That keeps routes like /api/data.json. For public/, the SDK lists the files at build time and ignores GET requests for their exact paths, because a route can start with the same path as a folder in public/. Files that the HTTP integration already ignores are not in this list, so ignoreStaticAssets: false still works for them.

If you change the base path at runtime with NUXT_APP_BASE_URL, the server filters do not match.

The deprecated autoInjectServerSentry modes do not get the configured paths or the list of public files, so there the server filter only covers the default /_nuxt/ folder.

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: 3440225 (PR test merge using develop at 6daef45)

Against: 6daef45 (develop) · base run #67728

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

Path Size % Change Change
@sentry/browser 30.54 kB - -
@sentry/browser - with treeshaking flags 28.73 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 28.6 kB - -
@sentry/browser (incl. Tracing) 53.67 kB - -
@sentry/browser (incl. Tracing Core) 40.59 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 53.67 kB - -
@sentry/browser (incl. Tracing, Profiling) 56.57 kB - -
@sentry/browser (incl. Tracing, Replay) 93.54 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 82.41 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 97.93 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 111.34 kB - -
@sentry/browser (incl. Feedback) 48.4 kB - -
@sentry/browser (incl. sendFeedback) 31.11 kB - -
@sentry/browser (incl. FeedbackAsync) 36.17 kB - -
@sentry/browser (incl. Metrics) 31.86 kB - -
@sentry/browser (incl. Logs) 32.13 kB - -
@sentry/browser (incl. Metrics & Logs) 32.8 kB - -
@sentry/react 32.56 kB - -
@sentry/react (incl. Tracing) 56.38 kB - -
@sentry/vue 38.75 kB - -
@sentry/vue (incl. Tracing) 56.68 kB - -
@sentry/svelte 30.57 kB - -
@sentry/effect (client) 42.25 kB - -
@sentry/effect (client, incl. Tracing) 49.41 kB - -
@sentry/effect (client, incl. Tracing, Logs, Metrics) 59.3 kB - -
@sentry/remix (Remix 3 client bundle) 59.39 kB - -
CDN Bundle 32.54 kB - -
CDN Bundle (incl. Tracing) 54.15 kB - -
CDN Bundle (incl. Logs, Metrics) 35.27 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 56.63 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 76.16 kB - -
CDN Bundle (incl. Tracing, Replay) 91.89 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 94.43 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 97.35 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 99.81 kB - -
CDN Bundle - uncompressed 94.92 kB - -
CDN Bundle (incl. Tracing) - uncompressed 160.25 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 103.26 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 167.88 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 233.5 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 280.54 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 288.17 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 292.47 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 300.09 kB - -
@sentry/nextjs (client) 60.09 kB - -
@sentry/sveltekit (client) 55.03 kB - -
@sentry/core/server 45.83 kB - -
@sentry/core/browser 14.46 kB - -
@sentry/node 156.36 kB -0.01% -1 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.45 kB - -
@sentry/node - without tracing 89.23 kB -0.01% -4 B 🔽
@sentry/node - without channel injection 145.29 kB - -
@sentry/aws-serverless 99.87 kB -0.01% -3 B 🔽
@sentry/cloudflare (withSentry) - minified 210.54 kB - -
@sentry/cloudflare (withSentry) 488.88 kB - -
@sentry/cloudflare (withSentry, instrumented CommonJS package) - minified 213.49 kB - -
@sentry/nextjs/cloudflare (withSentry) - minified 235.78 kB - -

View base workflow run

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Optional E2E tests

Some optional checks were not successful. They do not block the merge. 2 not successful, 70 successful. See the run.

Check Status
❌ CI: Optional E2E Tests / E2E nextjs-16-tunnel (cloudflare) Test (optional) Failing after 1m Details
❌ CI: Optional E2E Tests / E2E react-router-7-framework-instrumentation Test (optional) Failing after 1m Details
Successful checks
Check Status
✅ CI: Optional E2E Tests / E2E cloudflare-flue-send-to-sentry Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-mastra (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries (cloudflare) Test (optional) Successful in 41s Details
✅ CI: Optional E2E Tests / E2E astro-7 (static trace lifecycle) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v1 Test (optional) Successful in 26s Details
✅ CI: Optional E2E Tests / E2E deno (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-think (ai v6) Test (optional) Successful in 55s Details
✅ CI: Optional E2E Tests / E2E cloudflare-workers-without-tracing-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-eve Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries (latest) Test (optional) Successful in 44s Details
✅ CI: Optional E2E Tests / E2E cloudflare-think Test (optional) Successful in 51s Details
✅ CI: Optional E2E Tests / E2E node-eve (0.x) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-eve (orchestrion) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-14-supabase Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E astro-7 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (turbo) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (cloudflare) Test (optional) Successful in 37s Details
✅ CI: Optional E2E Tests / E2E cloudflare-mastra Test (optional) Successful in 45s Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (deno) Test (optional) Successful in 59s Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-openai-decisions (latest) Test (optional) Successful in 27s Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (bun) Test (optional) Successful in 57s Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-4-sourcemaps (Vite server) Test (optional) Successful in 39s Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v2 (MCP SDK OpenTelemetry) Test (optional) Successful in 28s Details
✅ CI: Optional E2E Tests / E2E express-5 (bun) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v2 Test (optional) Successful in 32s Details
✅ CI: Optional E2E Tests / E2E cloudflare-agent Test (optional) Successful in 42s Details
✅ CI: Optional E2E Tests / E2E express-5 (cloudflare) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-workers-send-to-sentry Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E cloudflare-pi-durable (latest) Test (optional) Successful in 40s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext, bun) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-eve (content off) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (static / nuxt generate) Test (optional) Successful in 40s Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries Test (optional) Successful in 48s Details
✅ CI: Optional E2E Tests / E2E node-fastify-6 Test (optional) Successful in 30s Details
✅ CI: Optional E2E Tests / E2E debug-id-sourcemaps Test (optional) Successful in 42s Details
✅ CI: Optional E2E Tests / E2E cloudflare-pi-durable Test (optional) Successful in 48s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-tunnel (cloudflare) Test (optional) Successful in 32s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (cloudflare, latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-cloudflare Test (optional) Successful in 35s Details
✅ CI: Optional E2E Tests / E2E express-5 (deno) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-openai-decisions Test (optional) Successful in 34s Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (kv-cache) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-flue Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E solid-2-ssr (cloudflare) Test (optional) Successful in 33s Details
✅ CI: Optional E2E Tests / E2E node-pi-durable Test (optional) Successful in 38s Details
✅ CI: Optional E2E Tests / E2E nuxt-5 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps Test (optional) Successful in 35s Details
✅ CI: Optional E2E Tests / E2E solidstart-2-tunnel Test (optional) Successful in 52s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E react-send-to-sentry Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-tunnel Test (optional) Successful in 42s Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (development) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-pi-durable (latest) Test (optional) Successful in 35s Details
✅ CI: Optional E2E Tests / E2E node-mastra Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry (static trace lifecycle) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (no upload) Test (optional) Successful in 31s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps kept) Test (optional) Successful in 34s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps enabled by Sentry) Test (optional) Successful in 36s Details
✅ CI: Optional E2E Tests / E2E node-flue (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E solidstart-2 Test (optional) Successful in 54s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-cloudflare Test (optional) Successful in 39s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E vue-3 (no Options API) Test (optional) Successful in 57s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps (delete all) Test (optional) Successful in 37s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps (manual upload) Test (optional) Successful in 30s Details
✅ CI: Optional E2E Tests / E2E vinext-cf-workers (workers cache) Test (optional) Successful in 42s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps Test (optional) Successful in 39s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps (no upload) Test (optional) Successful in 27s Details

@chargome chargome left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good, just two edge cases that might matter.

function getBuildAssetRequestFilters(): NonNullable<SentryNuxtServerOptions['ignoreSpans']> {
const buildAssetsPath = getNuxtBuildAssetsPath();
return buildAssetsPath
? [{ op: HTTP_SERVER, attributes: { [URL_PATH]: new RegExp(`^${escapeStringForRegex(buildAssetsPath)}`) } }]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

With the deprecated autoInjectServerSentry modes, sentry-runtime-flags.mjs is never imported. The filter then falls back to ^/_nuxt/ and misses a custom app.baseURL or buildAssetsDir. Should we import the flags there too?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

no, this is deprecated since a long time and it would add a bunch of code to support this. It's fine if we only support this in the normal setup.

Comment thread packages/nuxt/src/client/sdk.ts Resolved
… deprecated modes

The browser filter matched the manifest path anywhere in a URL, so it also
dropped spans of other hosts. It now matches only the app origin or
`app.cdnURL`, plus the base path.

The deprecated `autoInjectServerSentry` modes did not load the runtime flags,
so the server filter ignored a custom `app.baseURL` or `buildAssetsDir`. Both
modes now import the flags before the server config.
The `autoInjectServerSentry` modes are deprecated, and supporting the
configured build paths there needs too much code for them.
Nuxt 5 no longer fetches the build manifest after hydration. Without
payload extraction it only fetches it in the hourly check for new builds.
…ifacts

# Conflicts:
#	packages/nuxt/src/client/sdk.ts
#	packages/nuxt/src/server/sdk.ts
@s1gr1d
s1gr1d enabled auto-merge (squash) November 24, 2026 10:54
s1gr1d added a commit that referenced this pull request Nov 24, 2026
Similar to #26781
(same on Nuxt)

## What

With span streaming (the default), the SolidStart SDK sent a span for
every request to its build output under `/_build/`. Now the SDK ignores
these requests in both trace modes, also under a base path, and it keeps
real routes.

| Request | Before, span streaming (default) | Before, static mode |
Now, both modes |
|---|---|---|---|
| Build files that the HTTP integration does not ignore, for example
`/_build/assets/app.js.map` | **sent** | not sent | not sent |
| All build files on SolidStart 2, also `.js` and `.css` | **sent** |
not sent | not sent |
| Build files under a base path, for example
`/app/_build/assets/app.js.map` | **sent** | **sent** | not sent |
| Routes, also ones that contain `_build`, for example `/users/_build/`
| sent | sent | sent |

"Static mode" is `traceLifecycle: 'static'`. **Bold** marks the problems
this PR fixes.

## Why

The old filter was an event processor that dropped transactions by name.
Event processors do not run with span streaming, so the filter silently
stopped working. Now the SDK adds an `ignoreSpans` default on `url.path`
instead, which works in both modes. This is the same fix as for Nuxt.

The filter needs the base path (`server.baseURL` on SolidStart 1, Vite
`base` on SolidStart 2) when `Sentry.init()` runs. SolidStart 2 bundles
the SDK into the server build, so the build sets the value there.
SolidStart 1 loads `instrument.server.mjs` with `node --import` before
the server bundle, so the build now writes the base path into that file
too. In development, the server SDK does not know the base path yet, so
there the filter only matches `/_build/`.

On SolidStart 2, the SDK still sends spans for other static files such
as `/favicon.ico`, because Nitro's server spans skip the HTTP
integration's static file filter. That needs a separate fix in
`@sentry/server-utils`.
Nuxt 4.7.0 no longer fetches the build manifest after hydration, so the
test waited for a request that never came. The test page now calls
getAppManifest() on a button click.
The HTTP integration only ignores common static file extensions, so
requests for other files in public/ (for example .txt or .pdf) still
created spans. At build time, the SDK now lists the files in the public
dirs and ignores GET requests for their exact paths. Files the HTTP
integration already ignores are left out, so ignoreStaticAssets still
applies to them.
@s1gr1d s1gr1d changed the title fix(nuxt): Ignore build output spans with span streaming fix(nuxt): Ignore build output and public file spans with span streaming Nov 24, 2026
@s1gr1d
s1gr1d merged commit 9bad320 into develop Nov 24, 2026
473 of 475 checks passed
@s1gr1d
s1gr1d deleted the sig/nuxt-build-artifacts branch November 24, 2026 12:47
Comment on lines +32 to +34
listFiles(path.resolve(dir)).map(file =>
path.posix.join('/', dirURL ?? '', path.relative(path.resolve(dir), file).split(path.sep).join('/')),
),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Public file ignore paths are not URL-encoded

Filesystem paths like /my file.pdf are stored and matched raw, but server spans set url.path from URL.pathname (e.g. /my%20file.pdf), so public files with spaces or non-ASCII names still create GET spans.

Evidence
  • getPublicFilePaths() builds URL paths from path.relative(...) filesystem segments with no encodeURI/encodeURIComponent.
  • Those paths are baked into ignoreSpans as an exact url.path regex in getPublicFileRequestFilters().
  • HTTP server spans set url.path from parseStringToURLObject(...).pathname, which keeps percent-encoding (/my%20file.pdf, /caf%C3%A9.pdf).
  • Exact regex match therefore fails for any public file whose name is not already URL-safe.

Identified by Warden · code-review · MPX-U8C

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in #26817

@s1gr1d

s1gr1d commented Nov 24, 2026

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 a8c2b9b. Configure here.

s1gr1d added a commit that referenced this pull request Nov 24, 2026
## What

Came up in a warden comment but PR was already auto-merged:
#26781 (comment)

The Nuxt server SDK now also ignores requests for `public/` files with
spaces, non-ASCII letters or characters like `%` and `#` in their names,
for example `/my file.pdf` or `/café.pdf`.

## Why

Spans store the percent-encoded request path (`/my%20file.pdf`), but the
public file list from #26781 held the raw file names, so these paths
never matched. The SDK now encodes the paths with the same URL parsing
that sets `url.path`, so both sides use the same form.
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.

3 participants