Source Maps
Sentry supports demangling of transpiled, minified, and bundled JavaScript using source maps, which are JSON files that contain information about how to map your deployed code back to its original source(s). This lets you view source code context obtained from stack traces in its original, untransformed form. This is particularly useful when debugging minified and/or transpiled code, since both of those processes make large enough changes to the code that it often becomes nearly unrecognizable in its final deployed form. Source maps also allow Sentry to show each line in the stack trace in context, by including additional lines of code on either side.
Source Map Integration Setup
Integrate your project's source maps with Sentry using these steps:
1: Generate Source Maps
Source maps can be generated by transpilers, minifiers, or bundlers you might be using in your project. We provide instructions to configure common tools that output source maps here.
2: Provide Source Maps to Sentry
Source maps can be either:
- Uploaded directly to Sentry (strongly recommended)
- Served publicly over HTTP alongside your deployed code
If you use Webpack in your project, we recommend generating and uploading your source maps by way of sentry-webpack-plugin
. If you use a different tool to generate source maps, you can use sentry-cli
to upload them to Sentry.
Learn more about how to upload source maps here.
If you host your source maps alongside your deployed code, make sure your code files end with a `//# sourceMappingURL
comment pointing to the corresponding map.
Learn more about publicly hosting source maps here.
By default, if Sentry can't find the uploaded files it needs, it will attempt to download them from the URLs in the stacktrace. To disable this, turn off "Enable JavaScript source fetching" in either your organization's "Security & Privacy" settings or your project's general settings.
Next Steps
Additional Resources
- Package:
- npm:@sentry/browser
- Version:
- 8.24.0
- Repository:
- https://github.com/getsentry/sentry-javascript