Source Maps
Learn how to enable readable stack traces in your Sentry errors.
To enable readable stack traces in your Sentry errors, you need to upload your source maps to Sentry. Learn how to unminify your JavaScript code by watching this video or reading the step-by-step instructions below.
The easiest way to configure uploading source maps is by using the Sentry Wizard:
npx @sentry/wizard@latest -i sourcemaps
The wizard will guide you through the following steps:
- Logging into Sentry and selecting a project
- Installing the necessary Sentry packages
- Configuring your build tool to generate and upload source maps
- Configuring your CI to upload source maps
If you want to configure source maps upload with Angular manually, follow the steps below.
To generate source maps, you need to add the sourceMap
option to your angular.json
build configuration:
angular.json
{
// ...
"projects": {
"my-app": {
"architect": {
"build": {
"configurations": {
"production": {
"sourceMap": {
"scripts": true
}
}
}
}
}
}
}
}
Generating sourcemaps may expose them to the public, potentially causing your source code to be leaked. You can prevent this by configuring your server to deny access to .js.map
files, or by deleting the sourcemaps before deploying your application.
To upload your Angular project's source maps to Sentry, we recommend one of these options:
- 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
. - Nx Angular CLI and Sentry webpack plugin
If you're using Nx, use@nx/angular
CLI and the Sentry webpack plugin to set releases and upload source maps automatically when runningnx build
. - Sentry CLI
Upload source maps manually using the Sentry CLI.
Take a look at this guide for further options to upload source maps.
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").