Skip to content
Latchkey

sentry-cli sourcemaps upload for Readable Stack Traces

sentry-cli sourcemaps upload uploads minified bundles and their .map files to a release so Sentry can resolve real file and line numbers.

Without source maps, production errors point at minified code. This command (the modern replacement for releases files upload-sourcemaps) attaches them to the release you created in CI.

What it does

sentry-cli sourcemaps upload scans a directory for .js and .js.map files and uploads them as release artifacts. With sourcemaps inject first, it embeds a debug id into bundles so matching does not depend on a url-prefix. Files are associated with the --release version.

Common usage

Terminal
VERSION=$(sentry-cli releases propose-version)
sentry-cli sourcemaps inject ./dist
sentry-cli sourcemaps upload --release "$VERSION" ./dist
# legacy url-prefix style (no debug ids)
sentry-cli sourcemaps upload --release "$VERSION" \
  --url-prefix '~/static/js' ./dist

Options

FlagWhat it does
--release <ver>Release the artifacts belong to
--url-prefix <p>Path prefix to match runtime URLs (legacy)
--dist <name>Distribution within the release
sourcemaps injectEmbed debug ids before upload (recommended)
--strip-prefixStrip a local path prefix from artifact names
--ext js,mapExtensions to consider

In CI

Run sourcemaps inject during the build, then upload from the same artifacts. Delete the .map files from the deployed bundle after upload so you do not ship source maps publicly while Sentry still has them.

Common errors in CI

"error: A release slug is required (provide with --release)" means --release is missing and no SENTRY_RELEASE is set. "error: Auth token is required" means SENTRY_AUTH_TOKEN is missing. If traces stay minified, the upload succeeded but url-prefix did not match the runtime path; switch to sourcemaps inject so debug ids do the matching instead.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →