Skip to content

fix(bundler-plugins): Keep uploading when a directory has no source maps - #26092

Merged
JPeer264 merged 3 commits into
developfrom
fix/bundler-plugins-skip-empty-sourcemap-dirs
Nov 10, 2026
Merged

JPeer264 merged 3 commits into
developfrom
fix/bundler-plugins-skip-empty-sourcemap-dirs

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Why: The new sentry CLI throws a ValidationError for any directory that has no JS + source map pairs. SentryCliAdapter.uploadSourcemaps uploads directories one at a time, so the first empty directory stops the whole loop. @sentry/nextjs uploads .next/server first, so if server source maps are off, the client chunks that do have maps never get uploaded. The plugin only logs the error and the build passes, so this goes unnoticed. CLI 0.48+ stops reporting this error to Sentry, but it still throws, so the upload still stops without this change.

The CLI check stays strict on purpose, because it catches build misconfiguration. The adapter now passes allowEmpty: true, collects the directories that uploaded 0 files, and logs a warning for each. In direct-upload mode, "Successfully uploaded" is logged only if at least one directory actually uploaded something. The staged-upload path already returns early with a warning when no artifact has a source map, so it is unchanged.

Before:

[@sentry/nextjs - Node.js] Error: An error occurred. Couldn't finish all operations: ValidationError: Found 214 JS file(s) in '.next/server' but no companion .map files. [...] Pass --allow-empty to suppress.
# .next/static/chunks is never uploaded

After:

[@sentry/nextjs - Node.js] Warning: No source maps found in ".next/server", so nothing was uploaded from it. This usually means source map generation is not enabled for this build output. Enable it so Sentry can un-minify stack traces from these files.
[@sentry/nextjs - Node.js] Info: Successfully uploaded source maps to Sentry
# .next/static/chunks is uploaded

How to review: Start with src/core/cli.ts, then the two call sites in build-plugin-manager.ts. cli-contract.test.ts runs the real CLI (now sentry@^0.49.0 after #26200) against the mock server with one empty directory followed by one real directory.

Unsure about: A directory that does not exist still throws and stops the loop; allowEmpty only covers existing directories without source maps. I left that case out of this PR.

via bete, @betegon.

--

View Session in Sentry

The new CLI fails a directory with no JS + source map pairs. The adapter
uploads directories one by one, so the first empty one (.next/server for
Next.js apps without server source maps) aborted the rest, and client
source maps were never uploaded. Pass allowEmpty and warn per directory.

Co-Authored-By: Miguel Betegon <miguel.betegon@sentry.io>
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: 16458df (PR test merge using develop at 619b3aa)

Against: b31ae89 (develop) · base run #65576

⚠️ Baseline mismatch: 6 develop commit(s) in the PR build are missing from the baseline. Their size changes also affect this comparison. Compare commits. Re-run once develop's baseline build for 619b3aa finishes.

Path Size % Change Change
@sentry/browser 29.92 kB - -
@sentry/browser - with treeshaking flags 28.08 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.97 kB - -
@sentry/browser (incl. Tracing) 52.29 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 52.3 kB - -
@sentry/browser (incl. Tracing, Profiling) 55.27 kB +0.01% +1 B 🔺
@sentry/browser (incl. Tracing, Replay) 92.7 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 81.37 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 97.43 kB +0.01% +1 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 110.42 kB - -
@sentry/browser (incl. Feedback) 47.52 kB - -
@sentry/browser (incl. sendFeedback) 35.02 kB - -
@sentry/browser (incl. FeedbackAsync) 40.13 kB - -
@sentry/browser (incl. Metrics) 31.48 kB - -
@sentry/browser (incl. Logs) 31.77 kB +0.01% +1 B 🔺
@sentry/browser (incl. Metrics & Logs) 32.45 kB - -
@sentry/react 31.78 kB - -
@sentry/react (incl. Tracing) 54.76 kB +0.01% +1 B 🔺
@sentry/vue 38.33 kB - -
@sentry/vue (incl. Tracing) 55.33 kB - -
@sentry/svelte 29.95 kB - -
@sentry/remix (Remix 3 client bundle) 57.92 kB +0.01% +1 B 🔺
CDN Bundle 31.72 kB - -
CDN Bundle (incl. Tracing) 52.89 kB +0.01% +1 B 🔺
CDN Bundle (incl. Logs, Metrics) 34.52 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 55.39 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 76 kB - -
CDN Bundle (incl. Tracing, Replay) 91.17 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 93.72 kB +0.01% +1 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 97.3 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 99.89 kB - -
CDN Bundle - uncompressed 92.76 kB - -
CDN Bundle (incl. Tracing) - uncompressed 156.02 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 101.29 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 163.79 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 233.18 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 278.04 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 285.8 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 291.74 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 299.5 kB - -
@sentry/nextjs (client) 57.73 kB +0.01% +1 B 🔺
@sentry/sveltekit (client) 52.82 kB - -
@sentry/core/server 44.31 kB - -
@sentry/core/browser 14.02 kB - -
@sentry/node 157.41 kB +0.02% +20 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 82.28 kB - -
@sentry/node - without tracing 97.17 kB +0.03% +26 B 🔺
@sentry/node - without channel injection 137.7 kB +0.02% +24 B 🔺
@sentry/aws-serverless 106 kB +0.03% +23 B 🔺
@sentry/cloudflare (withSentry) - minified 203.51 kB - -
@sentry/cloudflare (withSentry) 505.76 kB - -
@sentry/nextjs/cloudflare (withSentry) - minified 225.19 kB - -

View base workflow run

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Optional E2E tests

Some optional checks were not successful. They do not block the merge. 6 not successful, 40 successful. See the run.

Check Status
❌ CI: Optional E2E Tests / E2E nextjs-16-cacheComponents (cloudflare) Test (optional) Failing after 10m Details
❌ CI: Optional E2E Tests / E2E node-eve Test (optional) Failing after 2m Details
❌ CI: Optional E2E Tests / E2E node-eve (latest) Test (optional) Failing after 1m Details
❌ CI: Optional E2E Tests / E2E node-eve (orchestrion) Test (optional) Failing after 2m Details
❌ CI: Optional E2E Tests / E2E node-flue (latest) Test (optional) Failing after 32s Details
❌ CI: Optional E2E Tests / E2E solidstart-2 Test (optional) Failing after 48s Details
Successful checks
Check Status
✅ CI: Optional E2E Tests / E2E gen-ai-libraries Test (optional) Successful in 50s Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (turbo) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nextjs-orpc Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (latest) Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nextjs-16-tunnel (cloudflare) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (cloudflare, latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E astro-7-static Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries (latest) Test (optional) Successful in 52s Details
✅ CI: Optional E2E Tests / E2E nextjs-14 (latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries (cloudflare) Test (optional) Successful in 51s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext, bun) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E debug-id-sourcemaps Test (optional) Successful in 42s Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry-static Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v1 Test (optional) Successful in 38s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (deno) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-mastra Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-fastify-6 Test (optional) Successful in 36s Details
✅ CI: Optional E2E Tests / E2E node-flue Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps Test (optional) Successful in 43s Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v2 Test (optional) Successful in 35s Details
✅ CI: Optional E2E Tests / E2E node-fastify-6 (tracer provider) Test (optional) Successful in 45s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-cloudflare Test (optional) Successful in 31s Details
✅ CI: Optional E2E Tests / E2E react-router-7-framework-instrumentation Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E astro-7 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-pi-durable Test (optional) Successful in 37s Details
✅ CI: Optional E2E Tests / E2E node-pi-durable (latest) Test (optional) Successful in 45s Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (tunnel-dev) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-openai-decisions Test (optional) Successful in 37s Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-cloudflare Test (optional) Successful in 36s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-openai-decisions (latest) Test (optional) Successful in 36s Details
✅ CI: Optional E2E Tests / E2E node-mastra (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E supabase-nextjs Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps Test (optional) Successful in 34s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (static / nuxt generate) Test (optional) Successful in 35s Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (latest) Test (optional) Successful in 46s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps kept) Test (optional) Successful in 45s Details

…s-skip-empty-sourcemap-dirs

Co-Authored-By: bete <28983162+betegon@users.noreply.github.com>
@betegon
betegon marked this pull request as ready for review November 10, 2026 15:45
@betegon
betegon requested review from a team, JPeer264 and stephanie-anderson November 10, 2026 15:45
@betegon
betegon requested review from a team as code owners November 10, 2026 15:45
@betegon
betegon requested review from Lms24, andreiborza, chargome, msonnb and s1gr1d and removed request for a team November 10, 2026 15:45
List every directory without source maps in a single warning instead of
repeating the same message for each one.
@JPeer264
JPeer264 merged commit 52948fa into develop Nov 10, 2026
429 of 437 checks passed
@JPeer264
JPeer264 deleted the fix/bundler-plugins-skip-empty-sourcemap-dirs branch November 10, 2026 17:08
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.

2 participants