Skip to content

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

Draft
sentry-junior[bot] wants to merge 1 commit into
developfrom
fix/bundler-plugins-skip-empty-sourcemap-dirs
Draft

sentry-junior[bot] wants to merge 1 commit 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. This is the largest share of the CLI's top sourcemap error (CLI-1FN, ~18k events/day, all from sentry@0.45.0 called through this adapter).

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.

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. Your bundler is not emitting sourcemaps. For Vite/Astro: `vite.environments.client.build.sourcemap: 'hidden'`. For webpack: `devtool: 'hidden-source-map'`. 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 against the mock server with one empty directory followed by one real directory.

Unsure about: package.json pins "sentry": "^0.45.0", which on 0.x resolves to <0.46.0. Users won't get the CLI-side fixes (getsentry/toolkit#1606, #1934, #1937) until that range is bumped. I left it alone because this PR shouldn't change dependencies.

via bete.

--

View Session [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: c6625a2 (PR test merge using develop at 23eca77)

Against: d138b7b (develop) · base run #64941

⚠️ Baseline mismatch: 1 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 23eca77 finishes.

Path Size % Change Change
@sentry/browser 30.4 kB - -
@sentry/browser - with treeshaking flags 28.54 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 28.43 kB - -
@sentry/browser (incl. Tracing) 52.72 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 52.72 kB - -
@sentry/browser (incl. Tracing, Profiling) 55.69 kB - -
@sentry/browser (incl. Tracing, Replay) 93.02 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 81.61 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 97.76 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 110.75 kB - -
@sentry/browser (incl. Feedback) 47.98 kB - -
@sentry/browser (incl. sendFeedback) 35.5 kB - -
@sentry/browser (incl. FeedbackAsync) 40.61 kB - -
@sentry/browser (incl. Metrics) 31.44 kB - -
@sentry/browser (incl. Logs) 31.73 kB - -
@sentry/browser (incl. Metrics & Logs) 32.45 kB - -
@sentry/react 32.29 kB - -
@sentry/react (incl. Tracing) 55.09 kB - -
@sentry/vue 38.67 kB - -
@sentry/vue (incl. Tracing) 55.73 kB - -
@sentry/svelte 30.43 kB - -
@sentry/remix (Remix 3 client bundle) 57.8 kB - -
CDN Bundle 32.19 kB - -
CDN Bundle (incl. Tracing) 53.24 kB - -
CDN Bundle (incl. Logs, Metrics) 34.47 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 55.19 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 75.88 kB - -
CDN Bundle (incl. Tracing, Replay) 91.46 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 93.39 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 97.56 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 99.56 kB - -
CDN Bundle - uncompressed 94.67 kB - -
CDN Bundle (incl. Tracing) - uncompressed 157.63 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 101.14 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 163.37 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 232.71 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 279.32 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 285.05 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 293.03 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 298.74 kB - -
@sentry/nextjs (client) 58.04 kB - -
@sentry/sveltekit (client) 53.23 kB - -
@sentry/core/server 44.25 kB - -
@sentry/core/browser 13.93 kB - -
@sentry/node 155.8 kB +0.02% +22 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 82.26 kB - -
@sentry/node - without tracing 96.89 kB +0.02% +15 B 🔺
@sentry/node - without channel injection 136.13 kB +0.02% +23 B 🔺
@sentry/aws-serverless 105.11 kB +0.02% +19 B 🔺
@sentry/cloudflare (withSentry) - minified 200.67 kB - -
@sentry/cloudflare (withSentry) 499.05 kB - -
@sentry/nextjs/cloudflare (withSentry) - minified 221.21 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. 3 not successful, 41 successful. See the run.

Check Status
❌ CI: Optional E2E Tests / E2E nuxt-5 (tunnel-dev) Test (optional) Failing after 2m Details
❌ CI: Optional E2E Tests / E2E node-flue (latest) Test (optional) Failing after 12s Details
❌ CI: Optional E2E Tests / E2E nuxt-5 Test (optional) Failing after 1m Details
Successful checks
Check Status
✅ CI: Optional E2E Tests / E2E nextjs-15 (turbo) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-eve (orchestrion) Test (optional) Successful in 36s Details
✅ CI: Optional E2E Tests / E2E node-mastra Test (optional) Successful in 42s Details
✅ CI: Optional E2E Tests / E2E node-eve (latest) Test (optional) Successful in 36s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-openai-decisions (latest) Test (optional) Successful in 16s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (deno) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E supabase-nextjs Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries (latest) Test (optional) Successful in 29s Details
✅ CI: Optional E2E Tests / E2E astro-7-static Test (optional) Successful in 47s Details
✅ CI: Optional E2E Tests / E2E node-eve Test (optional) Successful in 37s Details
✅ CI: Optional E2E Tests / E2E react-router-7-framework-instrumentation Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E debug-id-sourcemaps Test (optional) Successful in 26s Details
✅ CI: Optional E2E Tests / E2E node-openai-decisions Test (optional) Successful in 14s Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries (cloudflare) Test (optional) Successful in 20s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-cloudflare Test (optional) Successful in 17s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext, bun) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-fastify-6 Test (optional) Successful in 20s Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-pi-durable (latest) Test (optional) Successful in 22s Details
✅ CI: Optional E2E Tests / E2E solidstart-2 Test (optional) Successful in 35s Details
✅ CI: Optional E2E Tests / E2E nextjs-14 (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (static / nuxt generate) Test (optional) Successful in 19s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react (latest) Test (optional) Successful in 56s Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v1 Test (optional) Successful in 15s Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v2 Test (optional) Successful in 16s Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries Test (optional) Successful in 30s Details
✅ CI: Optional E2E Tests / E2E nextjs-orpc Test (optional) Successful in 54s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps kept) Test (optional) Successful in 19s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps Test (optional) Successful in 18s Details
✅ CI: Optional E2E Tests / E2E node-mastra (latest) Test (optional) Successful in 44s Details
✅ CI: Optional E2E Tests / E2E nextjs-16-tunnel (cloudflare) Test (optional) Successful in 39s Details
✅ CI: Optional E2E Tests / E2E node-flue Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E astro-7 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry-static Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps Test (optional) Successful in 22s Details
✅ CI: Optional E2E Tests / E2E node-fastify-6 (tracer provider) Test (optional) Successful in 20s Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (cloudflare, latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-pi-durable Test (optional) Successful in 22s Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (latest) Test (optional) Successful in 31s Details

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.

0 participants