Uploading Source Maps
We recommend uploading source maps as part of your build process, but you can also serve them publicly alongside your source files.
You need to set up your build system to create a release and attach the various source files. For Sentry to de-minify your stack traces, you must provide both the minified files (for example,
app.min.js) and 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. Alternatively, sentry-cli will automatically embed the sources (if missing) into your source maps.
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>
The release name must be unique within your organization and match the
release option in your SDK initialization code. Then, use the
upload-sourcemaps command to scan a folder for source maps, process them and upload them to Sentry.
sentry-cli releases files <release_name> upload-sourcemaps /path/to/files
You can find the artifacts uploaded to Sentry by navigating to [Project] » Project Settings » Source Maps.
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
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 alternatively pass the
--finalize flag to the
new command which will immediately finalize the release.
You don't have to upload the source files (referenced by source maps), but without them, the grouping algorithm will not be as strong, and the UI will not show any contextual source.
For more information, see our Releases API documentation.
It’s not uncommon for a web application to be accessible at multiple origins. See our documentation on multiple origins on how to handle this.