Skip to content

fix(cli): Skip a missing directory in sourcemap upload --allow-empty - #2216

Open
sentry-junior[bot] wants to merge 2 commits into
mainfrom
fix/cli-sourcemap-upload-missing-dir-allow-empty
Open

sentry-junior[bot] wants to merge 2 commits into
mainfrom
fix/cli-sourcemap-upload-missing-dir-allow-empty

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

The bundler plugins call sourcemap upload once per build output and pass allowEmpty (getsentry/sentry-javascript#26092). An empty output is skipped, but an output that doesn't exist still throws. That stops the loop, so the outputs after it never upload.

Rule:

  • With --allow-empty, a missing directory (or glob base) is treated like an empty one. Nothing is uploaded, the output names the directory, and the command exits 0. The SDK returns { filesUploaded: 0 }, so the plugin's existing "nothing uploaded" warning covers missing and empty outputs together.
  • Without the flag, a missing directory still fails.
  • A path that is a file or can't be read still fails, even with the flag.

Before (0.49.0)

$ SENTRY_ORG=my-org SENTRY_PROJECT=my-project sentry sourcemap upload ./missing --allow-empty
Error: Directory './missing' does not exist.
# exit 21

After

$ SENTRY_ORG=my-org SENTRY_PROJECT=my-project sentry sourcemap upload ./missing --allow-empty
╭────────────────┬───╮
│ Files uploaded │ 0 │
╰────────────────┴───╯

Directory './missing' does not exist, so nothing was uploaded from it.
# exit 0

On releases up to 0.47 there were about 15k "Directory … does not exist" issue events. They stop at 0.48 only because #1606 silences directory validation errors, and released versions don't tag the failing field on the silenced metric. The failure still reproduces on 0.49.0, as shown above.

via @betegon.

--

View Session [Sentry]

Bundler plugins upload each build output in turn with allowEmpty. A
build output that does not exist threw and stopped the outputs after it.
--allow-empty now treats a missing directory like an empty one: it
uploads nothing, names the directory, and exits 0. Without the flag, a
missing directory still fails.

Co-Authored-By: bete <28983162+betegon@users.noreply.github.com>
@vercel

vercel Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Nov 12, 2026 8:32pm UTC

Request Review

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 12, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

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 1 potential issue.

Fix All in Cursor

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

Reviewed by Cursor Bugbot for commit 16baa37. Configure here.

existsSync is false for any stat failure, so an inaccessible path was
skipped under --allow-empty instead of failing.

Co-Authored-By: bete <28983162+betegon@users.noreply.github.com>

This branch was previously deployed

1 inactive deployment
Preview — 49d54634 Deployed Nov 12, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant