Triagebellfor Sentry
Guide

Sentry source maps: upload them and fix minified traces

By the Triagebell team · Updated · 3 min read · How we check guides

Short answer

Sentry turns minified JavaScript frames back into your original files by matching each bundle to its source map through a Debug ID. Run npx @sentry/wizard@latest -i sourcemaps, or add Sentry's bundler plugin, or run sentry-cli sourcemaps inject and then sentry-cli sourcemaps upload on your build output, always before you deploy. If traces are still minified, the deployed files almost always lack the Debug ID snippet, or the maps were uploaded after the error happened.

Steps

  1. Generate maps in productionTurn on hidden source maps in your bundler for the production build.
  2. Inject Debug IDsUse Sentry's bundler plugin or run sentry-cli sourcemaps inject on the build output.
  3. Upload before deployingRun sentry-cli sourcemaps upload (or let the plugin upload) with SENTRY_AUTH_TOKEN, then deploy the injected files.
  4. Verify with a new errorTrigger an error on the new deploy and confirm the frames show your file names and source context.

How matching works: Debug IDs

Since SDK 7.47.0, Sentry links an event to its source map by Debug ID rather than by release name and file URL. Injection adds a unique ID to each minified file and to its map. This is what sentry-cli sourcemaps inject dist does to a file (output from sentry-cli 3.8.2, shortened):

!function(){try{var e="undefined"!=typeof window?window:...;
  e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="9c30da67-2a0a-5916-9be7-42229a44d74a"}catch(e){}}();
function a(){throw new Error("x")}a();
//# sourceMappingURL=app.min.js.map

//# debugId=9c30da67-2a0a-5916-9be7-42229a44d74a

The map gets a matching "debugId" field and its mappings are shifted for the added lines. At runtime the snippet registers the ID, the SDK puts it in the event's debug_meta, and Sentry finds the map with the same ID. Two consequences: the files you deploy must be the injected ones, and you no longer need to get release or URL prefixes exactly right for matching.

Upload source maps: wizard, bundler plugin or sentry-cli

The quickest route is npx @sentry/wizard@latest -i sourcemaps, which detects your tool and writes the config. Maps are generated and uploaded only in production builds.

ToolSetup (as of November 2026)
VitesentryVitePlugin from @sentry/bundler-plugins/vite, build.sourcemap: "hidden", plugin last in plugins
webpacksentryWebpackPlugin from @sentry/bundler-plugins/webpack, devtool: "hidden-source-map"
Rollup, esbuildSentry's Rollup and esbuild plugins; esbuild doesn't get deterministic Debug IDs
tsc, anything elsesentry-cli
React Native, Flutter webTheir own SDK tooling: React Native, Flutter

Current docs install all bundler plugins from one package, npm install @sentry/bundler-plugins --save-dev. A Vite config:

import { defineConfig } from 'vite';
import { sentryVitePlugin } from '@sentry/bundler-plugins/vite';

export default defineConfig({
  build: { sourcemap: 'hidden' },
  plugins: [
    react(),
    sentryVitePlugin({
      org: 'acme',
      project: 'web',
      authToken: process.env.SENTRY_AUTH_TOKEN,
      sourcemaps: { filesToDeleteAfterUpload: ['./dist/**/*.map'] },
    }),
  ],
});

With sentry-cli (2.17.0 or later), the order is build, inject, upload, deploy:

export SENTRY_ORG=acme SENTRY_PROJECT=web
npm run build
npx sentry-cli sourcemaps inject ./dist
npx sentry-cli sourcemaps upload ./dist
# now deploy ./dist

--release and --dist are optional with Debug IDs but still associate the files with a release. "hidden" maps omit the sourceMappingURL comment, so browsers don't fetch them, and filesToDeleteAfterUpload keeps them off your server.

Diagnose a minified trace, step by step

  1. Is the deployed file injected? Fetch the bundle from production (not your local dist) and search for _sentryDebugIds and //# debugId=. Missing means you injected after deploying, deployed a different build, or the plugin isn't running. Sentry reports this case as Sentry not part of build pipeline.
  2. Does the event carry the ID? In the event JSON, debug_meta must list a code_file exactly equal to each frame's abs_path. No debug_meta means an SDK older than 7.47.0.
  3. Is the map in Sentry? Check Settings → Projects → web → Source Maps: both the minified file and its map must be there with the same Debug ID.
  4. Was it uploaded before the error? Sentry doesn't re-process events received before the upload.
  5. Is the map itself right? Resolve one position locally from the frame's line and column: npx sentry-cli sourcemaps resolve dist/assets/index.js.map --line 1 --column 48213. If that also points to the wrong place, the bundler's map is wrong and Sentry is innocent. Check that the map includes sourcesContent.

Common causes, most frequent first

CauseFix
Deploy happened before or without injectMove inject and upload before the deploy step in CI
No SENTRY_AUTH_TOKEN in CI, upload silently skippedSet the token; pass --strict to sentry-cli to fail when a map can't be uploaded
Dev or watch build shippedUpload from the production build only
Another plugin changes files after Sentry'sPut the Sentry plugin last
Maps compressed before uploadUpload plain text, or --decompress (sentry-cli 2.4.0+); compress afterwards
source-map-support in a browser bundleRemove it; it breaks stack parsing
Map larger than 190 MiBSplit the bundle; Sentry ignores larger maps

The mistake people make next: "fixing" it by making maps public with a sourceMappingURL and turning on Enable JavaScript source fetching. That works only for code anyone can download, exposes your source, and still breaks on the next build that isn't reachable. Upload instead. Once traces are readable, read the stack trace from the top in-app frame; for a typical first readable error, see Cannot read properties of undefined.

Questions

Do Sentry source maps still need a release?

Not for matching. With Debug IDs (SDK 7.47.0+), Sentry links the event to the map by ID; --release and --dist only associate the files with a release.

Why are old errors still minified after I uploaded maps?

Sentry applies source maps when it processes an event and doesn't re-process events received earlier. New events from the injected build will be readable.

Should I deploy .map files to my server?

No need. Sentry reads uploaded maps, so build hidden maps and delete them after upload with filesToDeleteAfterUpload.

Sources

  1. Source Mapsdocs.sentry.io
  2. Sentry CLIdocs.sentry.io
  3. Troubleshooting Source Mapsdocs.sentry.io
  4. Vitedocs.sentry.io