Skip to content

Commit ee01726

Browse files
feedback
1 parent 93b1327 commit ee01726

File tree

16 files changed

+102
-110
lines changed

16 files changed

+102
-110
lines changed

docs/concepts/migration/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Below is a non-exhaustive list of some items that will not be relocated:
4848
- Issues
4949
- Events
5050
- Replays and/or other [Event Attachments](/platforms/javascript/enriching-events/attachments/)
51-
- Source Maps, [Debug Information Files](/cli/dif/) and/or [Artifact Bundles](/platforms/javascript/sourcemaps/troubleshooting_js/artifact-bundles/)
51+
- Source Maps, [Debug Information Files](/cli/dif/) and/or [Debug IDs](/platforms/javascript/sourcemaps/troubleshooting_js/debug-ids/)
5252
- Release information, including any references to external repositories via specific Pull Requests
5353
- Deployment information
5454
- Custom Avatars

docs/platforms/javascript/common/sourcemaps/debug-ids/index.mdx

Lines changed: 0 additions & 48 deletions
This file was deleted.

docs/platforms/javascript/common/sourcemaps/troubleshooting_js/artifact-bundles.mdx

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
title: What are Debug IDs
3+
sidebar_order: 7
4+
---
5+
6+
This documentation provides an in-depth look at Debug IDs, explaining how they work and why Sentry recommends using them. Visit [Uploading Source Maps](https://docs.sentry.io/platforms/javascript/guides/react/sourcemaps/uploading/) if you're looking for our guides on how to upload source maps.
7+
8+
## Introduction
9+
10+
Developers of modern websites often use some kind of build process when they add JavaScript to the site. This build process takes some input JavaScript, transforms it in some way, then outputs JavaScript that is served alongside the website. Some example transformations include minifying JavaScript code (so the final JavaScript bundle is smaller and faster to load) or removing TypeScript types (only JavaScript can run on the browser).
11+
12+
As a result, the JavaScript code running in production is typically not the same as the code written by the developer in the source editor. Instead, it has undergone several transformations, such as [minification](https://developer.mozilla.org/en-US/docs/Glossary/Minification), [transpilation](https://www.typescriptlang.org/), [downcompilation](https://babeljs.io/), [transformation](https://rollupjs.org/), [polyfilling](https://developer.mozilla.org/en-US/docs/Glossary/Polyfill), and others, aimed at improving performance and ensuring cross-browser compatibility.
13+
14+
Stack traces are essential to debug errors, but stack traces that come from generated JavaScript are often unreadable or unusable! They look nothing like the code you wrote, you can’t connect them to your source code repository, and minified variables or function names make you lose context about what is happening.
15+
16+
To ensure Sentry (and other tools) can provide stack traces that are both readable and useful, you’ll want to generate and use [source maps](https://firefox-source-docs.mozilla.org/devtools-user/debugger/how_to/use_a_source_map/index.html). Source maps are files that map the transformed JavaScript back to the original code. This allows Sentry to trace the error to your original source, which means you’ll get stack traces that look like the code you wrote, not the code you generated.
17+
18+
To connect source maps to a JavaScript file, we relied on filenames, but these often were unreliable. For example, a new deploy of a source map with the same filename would mean the source mapping gets incorrectly applied.
19+
20+
`//# source mappingURL=http://example.com/path/to/your/source map.map`
21+
22+
Given the url-based filename approach was unreliable, we came up with [Debug IDs](/platforms/javascript/sourcemaps/debug-ids#what-is-a-debug-id).
23+
24+
## What are Debug IDs
25+
26+
Inspired by approaches in native language ecosystems, Debug IDs are globally unique ids that identify a transformed JavaScript file and its associated source map.
27+
28+
![Debug IDs example](./img/debug-ids.png)
29+
30+
When using sentry-cli or bundler plugins for Webpack, Vite, or Rollup, Debug IDs are deterministically generated based on the source file contents. Note that deterministic Debug IDs for esbuild are not currently supported.
31+
32+
This approach is Sentry's recommended and most reliable method for associating minified JavaScript files with their original source code, making it easier to trace errors back to their source. As a result, **creating a release is no longer required**.
33+
34+
<Alert>
35+
36+
If you want to learn more about the rationale behind Debug IDs, we suggest taking a look at our [engineering blog](https://sentry.engineering/blog/the-case-for-debug-ids).
37+
38+
</Alert>
39+
40+
## How Sentry uses Debug IDs
41+
42+
To use Debug IDs, you need **version 7.47** or higher of one of our [JavaScript SDKs](https://github.com/getsentry/sentry-javascript). Once you're using a supported SDK, the process works as follows:
43+
44+
1. **A globally unique Debug ID is generated**: During the build process a Debug ID is generated, which is globally unique and ideally deterministic (typically a UUID).
45+
46+
2. **Debug IDs are embedded in minified files**: Each minified JavaScript file includes a special comment, such as `//# debugId=DEBUG_ID`, where `DEBUG_ID` is the unique identifier generated in the previous step.
47+
48+
3. **The same Debug ID is added to source maps**: Source maps also include the same Debug ID as a new attribute, linking the minified JavaScript file to its corresponding source map.
49+
50+
4. **Stack traces in Sentry link the Debug ID**: When an error occurs, Sentry's event contains the Debug ID, which allows Sentry to automatically link the error to the correct source map. This ensures the stack trace is resolved back to the original source code, providing you with clearer and more accurate debugging information—even if the JavaScript has been minified or transformed.
51+
52+
### Why use Debug IDs to uniminify your code?
53+
54+
Unminifying your code is essential for effective debugging. While there are other [legacy ways](https://docs.sentry.io/platforms/javascript/sourcemaps/troubleshooting_js/legacy-uploading-methods/) to achieve this at Sentry, using **Debug IDs are recommended by Sentry** as it is the most reliable and deterministic method. By unminifying your code, you get much clearer stack traces when errors occur. Instead of seeing obfuscated code, you'll see the exact code you originally wrote, making it far easier to understand and resolve issues. Below are examples that demonstrates the difference:
55+
56+
#### Bad Stack Trace
57+
![bad stack trace example](./img/bad-stack-trace.png)
58+
59+
#### Good Stack Trace
60+
![good stack trace example](./img/good-stack-trace.png)
61+
62+
## Retention Policy
63+
64+
Debug IDs have a retention period of _90 days_, using a _time to idle_ expiration mechanism.
65+
This means that uploaded Debug IDs are retained for as long as they are actively being used for event processing.
66+
Once an id has not been used to process incoming events for at least 90 days, it will automatically expire and be eligible for deletion.
67+
68+
## Associating a Release with Debug IDs
69+
70+
Since you might still want to know to which release an specific Debug ID is connected to, we designed a new way to still associate a `release` to your bundle.
71+
72+
The new Debug ID format supports a new kind of association to a `release` and optionally `dist`, known as weak release association. This type of association **will not require the creation of a `release`** before uploading source maps and will consequently allow the creation of a `release` as a separate step down the pipeline.
73+
74+
With an associated `release` and optionally `dist` you will be able to quickly go to the Debug ID from your `release` in Sentry, without having to worry about which Debug ID was used for your errors.

docs/platforms/javascript/common/sourcemaps/uploading/create-react-app.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ SENTRY_AUTH_TOKEN=___ORG_AUTH_TOKEN___
6464
### 3. Inject Debug IDs Into Build Artifacts
6565

6666
Debug IDs are used to match the stack frame of an event with its corresponding minified source and source map file.
67-
Visit [What are Artifact Bundles](/platforms/javascript/sourcemaps/troubleshooting_js/artifact-bundles/) if you want to learn more about Artifact Bundles and Debug IDs.
67+
Visit [What are Debug IDs](/platforms/javascript/sourcemaps/troubleshooting_js/debug-ids/) if you want to learn more about Debug IDs.
6868

6969
To inject Debug IDs, use the following command **every time after building your application**:
7070

docs/product/releases/setup/release-automation/github-actions/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ If your application is written in JavaScript you probably deploy minified applic
5656
stack traces in your Sentry errors, you need to upload source maps to Sentry.
5757
5858
Provide the path(s) to your source maps via the `sourcemaps` option to ensure proper un-minification of your stack traces.
59-
Visit [What are Artifact Bundles](/platforms/javascript/sourcemaps/troubleshooting_js/artifact-bundles/) if you want to learn more.
59+
Visit [What are Debug IDs](/platforms/javascript/sourcemaps/troubleshooting_js/debug-ids/) if you want to learn more.
6060

6161
```yml
6262
- uses: actions/checkout@v4

includes/sentry-cli-sourcemaps.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ SENTRY_AUTH_TOKEN=___ORG_AUTH_TOKEN___
2020

2121
### 3. Inject Debug IDs Into Artifacts
2222

23-
Debug IDs are used to match the stack frame of an event with its corresponding minified source and source map file. Visit [What are Artifact Bundles](/platforms/javascript/sourcemaps/troubleshooting_js/artifact-bundles/) if you want to learn more about Artifact Bundles and Debug IDs.
23+
Debug IDs are used to match the stack frame of an event with its corresponding minified source and source map file. Visit [What are Debug IDs](/platforms/javascript/sourcemaps/troubleshooting_js/debug-ids/) if you want to learn more about Debug IDs.
2424

2525
To inject Debug IDs, use the following command:
2626

0 commit comments

Comments
 (0)