Source Maps
To enable readable stack traces in your Sentry errors, you need to upload your source maps to Sentry.
Uploading Source Maps in an Angular project
Sentry uses releases to match the correct source maps to your events. This page explains how to generate source maps, set releases, and upload source maps to Sentry either manually or automatically when bundling your Angular app.
Generating Source Maps
To generate source maps, you need to add the sourceMap
option to your angular.json
build configuration:
angular.json
Copied
{
// ...
"projects": {
"my-app": {
"architect": {
"build": {
"configurations": {
"production": {
"sourceMap": {
"scripts": true
}
}
}
}
}
}
}
}
Two Ways to Upload Source Maps
You can either set releases and upload source maps automatically using the Angular CLI, or upload source maps manually using the Sentry-CLI.
- Angular CLI and Sentry Webpack Plugin
Use the Angular CLI, a custom Angular builder and the Sentry Webpack plugin to set releases and upload source maps automatically when runningng build
. - Sentry CLI
Upload source maps manually using the Sentry-CLI.
Take a look at this guide for further options to upload source maps.
Additional Resources
- Using sentry-cli to Upload Source Maps
- 4 Reasons Why Your Source Maps Are Broken
- Debug Your Node.js Projects with Source Maps
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").
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").
- Package:
- npm:@sentry/angular
- Version:
- 7.51.0
- Repository:
- https://github.com/getsentry/sentry-javascript