How do I upload source maps so errors show my original code?

Create an upload token on Monitoring's Setup page. Inject a debug ID into each bundle and its map with sentry-cli sourcemaps inject, deploy that bundle, and POST each .map file to your DSN's host with the token as a Bearer header. Opening an issue then shows your original file, line and function.

Last updated 26 November 2026. By Paul Badarau.

A fictional booking app for a yoga studio builds into dist/assets. Its DSN ends in /4821, the number of its Project, so its maps go to /api/4821/artifacts/ on the same host as the DSN. Before the upload, an error on the booking page reads at e (index-3f9a2c.js:1:48213). After it, the same frame reads confirmBooking in src/booking/confirm.ts, line 42.

The steps:

  1. An Owner or Administrator opens Setup in Monitoring and chooses Create upload token for the Project. Copy it straight away, because it is shown once. An upload token is not a DSN. It can store maps for that Project and cannot send events, and a DSN cannot upload. A Project can have 8 active upload tokens.
  2. Build with source maps turned on in your bundler, so each bundle has a .map file beside it.
  3. Inject debug IDs with sentry-cli sourcemaps inject dist/assets, or with the debug ID option of the Sentry bundler plugin. This writes the same ID into each bundle and its map. Deploy these injected files, not an earlier build.
  4. Upload each map with the token: curl --fail -X POST "https://DSN_HOST/api/4821/artifacts/" -H "Authorization: Bearer $PD_UPLOAD_TOKEN" -H "Content-Type: application/json" --data-binary @dist/assets/index-3f9a2c.js.map. The answer says how many maps were stored, unchanged or replaced, and which debug IDs it found.
  5. Open an issue from the new build. Each frame shows the original function, file and line, with the minified frame underneath.

A zip of up to 32 maps also works, sent as application/zip. Without debug IDs, send the headers x-postdeploy-release and x-postdeploy-file with each map instead. The release must equal the release in your Sentry.init, and the file is the path of the bundle as the browser loads it, such as /assets/index-3f9a2c.js, not the path of the map.

The sentry-cli sourcemaps upload command does not work here, because it talks to a different upload API. Inject with the CLI, then upload with the request above.

Check the limits before you automate this. One upload can be at most 1 MiB, and one map at most 512 KiB once its source text is removed. A Project holds at most 200 maps, and a map cannot be deleted on its own. Every build with new debug IDs adds new maps, so a site that deploys once a day with three bundles reaches 200 in under 10 weeks. Monitoring never stores or shows your source text, only the original file, line and function names.

The product page for this is Monitoring.

Start your 14-day free trial