Skip to content

Commit fda4352

Browse files
Add Debug IDs page for React Native (#13764)
1 parent ae59e33 commit fda4352

File tree

6 files changed

+40
-9
lines changed

6 files changed

+40
-9
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: What are Debug IDs
3+
sidebar_order: 7
4+
---
5+
6+
<Include name="debug-ids.mdx" />
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: What are Debug IDs
3+
sidebar_order: 20_000
4+
---
5+
6+
<Include name="debug-ids.mdx" />
Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
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.
1+
<PlatformSection notSupported={["react-native"]}>
2+
This documentation provides an in-depth look at Debug IDs, explaining how they work and why Sentry recommends using them. Visit [Uploading Source Maps](/platforms/javascript/guides/react/sourcemaps/uploading/) if you're looking for our guides on how to upload source maps.
3+
</PlatformSection>
4+
<PlatformSection supported={["react-native"]}>
5+
This documentation provides an in-depth look at Debug IDs, explaining how they work and why Sentry recommends using them. Visit [Uploading Source Maps](/platforms/react-native/sourcemaps/uploading/) if you're looking for our guides on how to upload source maps.
6+
</PlatformSection>
77

88
## Introduction
99

@@ -29,7 +29,7 @@ Inspired by approaches in native language ecosystems, Debug IDs are globally uni
2929

3030
When using sentry-cli or Sentry 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.
3131

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. Because debug IDs will generally change across releasess if the file content is changed **creating a release is no longer required**. Release names were previously used to disambiguate sourcemaps with the same name across deployments.
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. Because debug IDs will generally change across releases if the file content is changed **creating a release is no longer required**. Release names were previously used to disambiguate sourcemaps with the same name across deployments.
3333

3434
<Alert>
3535

@@ -39,25 +39,40 @@ If you want to learn more about the rationale behind Debug IDs, we suggest takin
3939

4040
## How Sentry uses Debug IDs
4141

42-
<PlatformSection notSupported={["javascript.nextjs"]}>
42+
<PlatformSection notSupported={["javascript.nextjs", "react-native"]}>
4343
To use Debug IDs, ensure that you're using **Sentry's SDK version 7.47 or higher**. Once you're on a supported version, follow the steps outlined below:
4444
</PlatformSection>
4545
<PlatformSection supported={["javascript.nextjs"]}>
4646
For Debug IDs with Next.js, you’ll need **Sentry's SDK version 8.0.0 or higher**. Once you're on a supported version, follow the steps outlined below:
4747
</PlatformSection>
48+
<PlatformSection supported={["react-native"]}>
49+
For Debug IDs with React Native, you’ll need **Sentry's React Native SDK version 5.16.0 or higher**. Once you're on a supported version, follow the steps outlined below:
50+
</PlatformSection>
4851

4952

53+
<PlatformSection notSupported={["react-native"]}>
5054
1. **A globally unique Debug ID is generated**: During the build process, if you are using one of Sentry's Bundler Plugins or Sentry CLI a Debug ID is generated, which is globally unique and ideally deterministic.
5155

5256
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.
57+
</PlatformSection>
58+
<PlatformSection supported={["react-native"]}>
59+
1. **A globally unique Debug ID is generated**: During the build process, if you are using [Sentry's Metro Plugin](/platforms/react-native/manual-setup/metro/) a Debug ID is generated, which is globally unique and ideally deterministic.
60+
61+
2. **Debug IDs are embedded in the output files**: Each JavaScript file includes a special comment, such as `//# debugId=DEBUG_ID`, where `DEBUG_ID` is the unique identifier generated in the previous step.
62+
</PlatformSection>
5363

5464
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.
5565

5666
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.
5767

5868
### Why use Debug IDs to uniminify your code?
5969

60-
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 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:
70+
<PlatformSection notSupported={["react-native"]}>
71+
Unminifying your code is essential for effective debugging. While there are other [legacy ways](/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 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:
72+
</PlatformSection>
73+
<PlatformSection supported={["react-native"]}>
74+
Unminifying your code is essential for effective debugging. While there are other [legacy ways](/platforms/react-native/sourcemaps/troubleshooting/legacy-uploading-methods/) to achieve this at Sentry, using **Debug IDs are recommended by Sentry** as it is the most reliable 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:
75+
</PlatformSection>
6176

6277
#### Bad Stack Trace
6378
![bad stack trace example](./img/bad-stack-trace.png)
@@ -78,3 +93,7 @@ Since you might still want to know to which release an specific Debug ID is conn
7893
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.
7994

8095
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.
96+
97+
<PlatformSection supported={["react-native"]}>
98+
This is done by the Sentry Xcode and Sentry Gradle plugins automatically during the React Native application build process.
99+
</PlatformSection>

0 commit comments

Comments
 (0)