Skip to content

Commit b22f4be

Browse files
iambriccardoJesse-Boxlizokm
authored
feat(sourcemaps): Add more sourcemaps docs (#6667)
* feat(sourcemaps): Add more sourcemaps docs * Improve docs * Improve docs * Add new diagram * Improve docs * Improve docs * Update src/platform-includes/sourcemaps/artifact-and-release-bundles/javascript.mdx Co-authored-by: Liza Mock <[email protected]> * Update src/platform-includes/sourcemaps/artifact-and-release-bundles/javascript.mdx Co-authored-by: Liza Mock <[email protected]> * Update src/platform-includes/sourcemaps/artifact-and-release-bundles/javascript.mdx Co-authored-by: Liza Mock <[email protected]> * Update src/platform-includes/sourcemaps/artifact-and-release-bundles/javascript.mdx Co-authored-by: Liza Mock <[email protected]> * Update src/platform-includes/sourcemaps/artifact-and-release-bundles/javascript.mdx Co-authored-by: Liza Mock <[email protected]> * Update src/platform-includes/sourcemaps/artifact-and-release-bundles/javascript.mdx Co-authored-by: Liza Mock <[email protected]> * Update src/platform-includes/sourcemaps/upload/cli/javascript.mdx Co-authored-by: Liza Mock <[email protected]> * Update src/platform-includes/sourcemaps/upload/cli/javascript.mdx Co-authored-by: Liza Mock <[email protected]> * Update src/platform-includes/sourcemaps/upload/cli/javascript.mdx Co-authored-by: Liza Mock <[email protected]> * Update src/platform-includes/sourcemaps/artifact-and-release-bundles/javascript.mdx Co-authored-by: Liza Mock <[email protected]> * Added: Diagrams * Modified: Index to include link to page * Removed: Screenshot from source map index --------- Co-authored-by: Jesse Box <[email protected]> Co-authored-by: Liza Mock <[email protected]>
1 parent 2971674 commit b22f4be

File tree

9 files changed

+73
-12
lines changed

9 files changed

+73
-12
lines changed
Loading
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
This article explains the difference between Artifact and Release bundles, and the implications of 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.
2+
3+
## Introduction
4+
5+
Sentry currently supports two methods of uploading sourcemaps: **Release bundles** and **Artifact bundles**. A bundle contains all the minified sources and source maps (known as _artifacts_) required for Sentry to unminify the frames of a stack trace.
6+
7+
## Release Bundles
8+
9+
A release bundle is a bundle format that's connected to an existing `release` in Sentry. That's why you **have to create a `release`** before uploading your artifacts.
10+
11+
| Pros | Cons |
12+
| :-------------------------------------- | :------------------------------------------------------------------------------------------------ |
13+
| Currently works with every SDK version. | Configuring your build pipeline to upload artifacts can be very challenging. |
14+
| | Requires your project to use Sentry Releases. |
15+
| | **In the near future, our bundler plugins and `sentry-cli` will use artifact bundles by default** |
16+
17+
### How Do They Work?
18+
19+
![How Release Bundles Work](release-bundles.png)
20+
21+
Release bundles get their name from using a `release` as a way to index a specific bundle. The `release` is extracted from an incoming error and used to look up the most recent bundle. When a bundle is found, we use the value of `abs_path` in each frame to find the corresponding minified source in the retrieved bundle. Once the minified source is found, we try to discover its source map with a series of heuristics, such as looking at the value of `sourceURLMapping`.
22+
23+
Based on user feedback, we've found that using a stack frames `abs_path` to find its relevant artifacts to be **very unreliable**. Dynamic paths (For example: `https://www.site.com/{some_value}/scripts/script.js`) will likely require addition SDK configuration to unminify stack frames.
24+
25+
## Artifact Bundles
26+
27+
An artifact bundle is our new format that addresses the shortcomings of release bundles by **adding support for Debug IDs** and **removing the need to create a `release`**.
28+
29+
| Pros | Cons |
30+
| :-------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------- |
31+
| With Debug IDs, configuring your build pipeline to upload artifacts is straightforward. | **Requires you to update the version of our Javascript SDK and bundler plugin ( or `sentry-cli`).** |
32+
| Associating a release is still possible, but not required. | May cause problems if your application relies on [Subresource Integrity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity) checks . |
33+
34+
### How Do They Work?
35+
36+
![How Release Bundles Work](artifact-bundles.png)
37+
38+
Artifact Bundles solve the challenge of matching paths by using a new identification mechanism known as Debug IDs. Rather than relying on paths we uniquely identify and bind pairs of minified sources and source maps with an Debug ID (UUID). With this, we are able to quickly identify the minified source and corresponding source map without ever needing to check any paths.
39+
40+
<Note>
41+
42+
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).
43+
44+
</Note>
45+
46+
### Associating a Release with Artifact Bundles
47+
48+
Since you might still want to know which `release` a specific artifact bundle is connected to, we came up with a new way to still connect your bundle to a `release`.
49+
50+
Artifact Bundles support a new kind of association to a `release` (and `dist`), known as a "weak association". In practice, this **doesn't require the creation of a `release`** before uploading source maps, allowing the creation of a `release` as a separate step down the pipeline.
51+
52+
With an associated `release` and optionally `dist` you will be able to quickly go to the Artifact Bundle from your `release` in Sentry, without having to worry about which artifact bundle was used for your errors.
53+
54+
## Summary
55+
56+
If you've had trouble uploading source maps in the past, we recommend you try artifact bundles with Debug IDs, but if your application already uses them successfully, we recommend you continue to use release bundles .
Loading

src/platform-includes/sourcemaps/overview/javascript.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Uploading Source Maps to Sentry
1+
## Uploading Source Maps
22

33
We've compiled a list of guides on how to upload source maps to Sentry for the most popular JavaScript build tools:
44

@@ -23,4 +23,8 @@ Though we strongly recommend uploading source maps as part of your build process
2323

2424
</Note>
2525

26+
## Artifact vs Release Bundles
27+
28+
A bundle is how Sentry stores and uses your source maps to un-minify the stack traces of incoming errors. With our new bundle format being recently released, <PlatformLink to="/sourcemaps/artifact-and-release-bundles">visit this page</PlatformLink> to understand how Artifact Bundles address the headaches that can come with using Release Bundles.
29+
2630
</PlatformSection>
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
To enable readable stack traces in your Sentry errors, you need to upload your source maps to Sentry.
2-
3-
![Minified stack trace vs. readable stack trace](readable-stacktraces.png)
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
`@sentry/nextjs` will generate and upload source maps automatically, in order to enable errors to have readable stacktraces.
22

33
To upload source maps, the `@sentry/nextjs` SDK uses the [Sentry Webpack Plugin](https://github.com/getsentry/sentry-webpack-plugin) under the hood. See the [Manual Configuration](../manual-setup/#configure-source-maps) page and the Sentry [Webpack Plugin documentation](https://github.com/getsentry/sentry-webpack-plugin#cli-configuration) for more details. If you are using Vercel, then you can also use the [Vercel integration](/product/integrations/deployment/vercel/) to upload source maps during deployments automatically.
4-
5-
![Minified stack trace vs. readable stack trace](readable-stacktraces.png)

src/platform-includes/sourcemaps/upload/cli/javascript.mdx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ Uploading artifact bundles requires:
4949

5050
</Note>
5151

52-
If you decide to upload as an artifact bundle you should use Debug IDs. Debug IDs are unique identifiers generated by the `sentry-cli` that bind together minified sources and their respective source maps. Each pair of `(minified source, source map)` contain the same Debug ID, which is injected into specific parts of each file.
53-
54-
The generated Debug IDs are used by Sentry during processing to determine which source map file should be used to symbolicate an event's stackframes.
52+
If you decide to upload source maps as an artifact bundle, you should use Debug IDs, which are described in detail in [artifact bundles vs. release bundles](ADD LINK).
5553

5654
<Note>
5755

@@ -81,7 +79,7 @@ module.exports = {
8179

8280
### 2. Inject Debug IDs Into Artifacts
8381

84-
During injection, `sentry-cli` will evaluate all minified sources and respective source maps (known as build artifacts), adding the Debug IDs required to correctly symbolicate an event.
82+
During injection, `sentry-cli` will evaluate all minified sources and respective source maps (known as build artifacts), adding the Debug IDs required to correctly unminify an event.
8583

8684
To inject Debug IDs, use the new `inject` command:
8785

@@ -129,7 +127,7 @@ Open up Sentry and navigate to **Project Settings > Source Maps**. If you choose
129127

130128
#### Associating `release` with Artifact Bundle (Optional)
131129

132-
If you are having troubles with Debug IDs, we suggest that you associate a release to an artifact bundle. _The release association will help Sentry figure out which artifact bundle(s) to use for symbolication when Debug IDs are not present._
130+
If you're having trouble with Debug IDs, we suggest that you associate a release with an artifact bundle. _The release association will help Sentry figure out which artifact bundle(s) to use for unminification when Debug IDs are not present._
133131

134132
First, you must provide a `release` property in your SDK options.
135133

@@ -177,7 +175,7 @@ Sentry can also use [releases](/product/releases/) to match uploaded source maps
177175

178176
<Note>
179177

180-
We strongly suggest to use the new Debug IDs system for uploading your artifacts since it provides more reliable symbolication and the old release-based system will be faded out in the future.
178+
We strongly suggest that you use the new Debug ID system for uploading your artifacts since it provides more reliable unminification and the old release-based system will be faded out in the future.
181179

182180
</Note>
183181

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: Artifact vs. Release Bundles
3+
description: "Learn about the differences between artifact bundles and release bundles."
4+
sidebar_order: 6
5+
---
6+
7+
<PlatformContent includePath="sourcemaps/artifact-and-release-bundles" />
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Validating Files
33
description: "Learn about Sentry's online validation tool that can be used to test your source maps against your hosted source."
4-
sidebar_order: 6
4+
sidebar_order: 3
55
---
66

77
<PlatformContent includePath="sourcemaps/validating" />

0 commit comments

Comments
 (0)