Source Maps
Sentry supports un-minifying JavaScript via source maps, which lets you view source code context obtained from stack traces in their original untransformed form. This is particularly useful for debugging minified code (for example, UglifyJS), or transpiled code from a higher-level language (such as TypeScript and ES6).
Sentry will automatically fetch the source code and source maps by scraping the URLs within the stack trace. However, you may have legitimate reasons for disabling the JavaScript source fetching in Sentry.
Capturing Source Maps
Most modern JavaScript transpilers support source maps. Below you'll find our recommended instructions, but we also provide instructions for various common tools:
We recommend using Sentry's Webpack plugin to configure source maps and upload them automatically during the build:
npm install --save-dev @sentry/webpack-plugin
Next you need to generate an access token for our API. Within your organization's settings, navigate to Developer Settings, create a new internal integration, and provide a name appropriate to your organization. Important: Select Releases -> Admin for Permissions.
The Releases -> Admin permission is also known as 'project:releases' in other API documentation.
You may configure sentry-cli through its documented mechanisms, or instead simply bind required parameters when initializing the plugin:
webpack.config.js
const SentryWebpackPlugin = require("@sentry/webpack-plugin");
module.exports = {
// other configuration
configureWebpack: {
plugins: [
new SentryWebpackPlugin({
// sentry-cli configuration
authToken: process.env.SENTRY_AUTH_TOKEN,
org: "exmaple-org",
project: "example-project",
// webpack specific configuration
include: ".",
ignore: ["node_modules", "webpack.config.js"],
}),
],
},
};
Additional information can be found in our Webpack documentation.
Additional Resources
- Using sentry-cli to Upload Source Maps
- Debuggable JavaScript with Source Maps
- 4 Reasons Why Your Source Maps Are Broken
- Debug Your Node.js Projects with Source Maps
- Package:
- npm:sentry-cordova
- Version:
- 0.12.3
- Repository:
- https://github.com/getsentry/sentry-cordova