Skip to content

fix(cli): Accept glob patterns as the sourcemap upload target - #1934

Merged
BYK merged 2 commits into
mainfrom
fix/sourcemap-upload-glob-target
Nov 4, 2026
Merged

BYK merged 2 commits into
mainfrom
fix/sourcemap-upload-glob-target

Conversation

@sentry-junior

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

Copy link
Copy Markdown
Contributor

Part of CLI-1FN. About 1 in 8 sampled events is Directory '…' does not exist., and half of those are globs: .next/static/**, .next/**/*.js, **/*.js. They come from @sentry/bundler-plugins (via @sentry/nextjs) direct-upload mode, which passes the user's sourcemaps.assets straight to sourcemap upload as the directory. That option is documented as a glob, so the upload fails on every build.

sourcemap upload now accepts a glob. It walks the glob's static base and keeps a pair when the rest of the pattern matches its JS file or its .map file. A path that exists as a directory is still used as-is, so Next.js names like app/[locale] keep working.

Before

$ sentry sourcemap upload '.next/static/**' --release 1.0.0
Error: Directory '.next/static/**' does not exist.

After

$ sentry sourcemap upload '.next/static/**' --release 1.0.0
╭────────────────┬───────╮
│ Organization   │ acme  │
│ Project        │ web   │
│ Files uploaded │ 6     │
│ Release        │ 1.0.0 │
╰────────────────┴───────╯

(This is a real Next.js 16 build uploaded to a local mock of the chunk-upload API.)

A missing base still gets a clear error, now naming the base directory: Directory '.next/static' does not exist.

@sentry/bundler-plugins pins sentry@^0.45.0, which on 0.x semver means <0.46.0. Plugin users get this fix only after that range is bumped.

via bete.

--

View Session [Sentry]

Bundler plugins pass sourcemaps.assets straight to `sourcemap upload`,
and that option is documented as a glob. A target like '.next/static/**'
failed with "Directory '.next/static/**' does not exist." (CLI-1FN).

Walk the glob's static base and keep the pairs whose JS or map file the
rest of the pattern matches. An existing directory is still used as-is,
so names like '[locale]' keep working.

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

vercel Bot commented Nov 4, 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 4, 2026 9:57am UTC

Request Review

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 4, 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 c8d0427. Configure here.

A glob whose wildcard comes before a dot segment, like '**/.next/**',
could never match: its base is '.', and the walk skipped hidden
directories before the glob saw them. Walk them for glob targets and let
the glob decide, so dot segments match only when the pattern names them,
the same as the glob package the bundler plugins use.
@BYK
BYK merged commit e807891 into main Nov 4, 2026
27 checks passed
@BYK
BYK deleted the fix/sourcemap-upload-glob-target branch November 4, 2026 15:00

This branch was previously deployed

1 inactive deployment
Preview — a1cdf0c8 Deployed Nov 4, 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