Sentry CLI

Upload Source Maps Using sentry-cli

When using sentry-cli to upload source maps, you need to set up your build system to both create a release and upload the various source files corresponding to that release. For Sentry to demangle your stack traces, provide both:

  • The deployed files (in other words, the results of your transpilation/minification/bundling process; for example, app.min.js)
  • The corresponding source maps

If the source map files do not contain your original source code (sourcesContent), you must also provide the original source files. Sentry CLI will attempt to automatically embed the sources in your source maps if they are missing.

Sentry uses releases to match the correct source maps to your events. To create a new release, run the following command (for example, during publishing):

sentry-cli releases new <release_name>
sentry-cli releases files <release_name> upload-sourcemaps /path/to/files

This command will upload all files ending in .js and .map to the specified release. If you wish to change these extensions – for example, to upload typescript sources – use the --ext option:

sentry-cli releases files <release_name> upload-sourcemaps --ext ts --ext map /path/to/files

Until now, the release is in a draft state (“unreleased”). Once all source maps have been uploaded, and your app has been published successfully, finalize the release with the following command:

sentry-cli releases finalize <release_name>

For convenience, you can pass the --finalize flag to the new command, which will immediately finalize the release.

For more information, see our sentry-cli docs.

It’s not uncommon for a web application to be accessible at multiple origins. See our documentation on multiple origins to learn how to handle this.

Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").