-
-
Notifications
You must be signed in to change notification settings - Fork 236
feat(sourcemaps): Inject debugId into sourcemaps, not debug_id
#3005
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: szokeasaurusrex/remove-metrics
Are you sure you want to change the base?
feat(sourcemaps): Inject debugId into sourcemaps, not debug_id
#3005
Conversation
|
…134) The debug ID field on all source maps is now **serialized as `debugId` rather than `debug_id`**. To maintain backwards-compatibility with source maps that contain a `debug_id` field, we can still read the `debug_id` field. If a source map contains a `debugId` field and a `debug_id` field, **the `debugId` field takes precedence, which is a change from the old behavior**. Corresponding Sentry CLI PR: getsentry/sentry-cli#3005 Closes #96 Closes [CLI-240](https://linear.app/getsentry/issue/CLI-240/turn-debug-id-field-to-debugid)
b3b6e0d to
bb32428
Compare
debugId, not debug_iddebugId into sourcemaps, not debug_id
(#3005) Align debug ID injection [with the relevant TC39 proposal](https://github.com/tc39/ecma426/blob/main/proposals/debug-id.md#debug-ids-in-source-maps) by upgrading the `sourcemap` crate to [9.3.0](https://github.com/getsentry/rust-sourcemap/releases/tag/9.3.0), which serializes the Debug ID on a sourcemap [under the `"debugId"` key, instead of the `"debug_id"` key](getsentry/rust-sourcemap#134). The crate still supports reading the `"debug_id"` key, but the `"debugId"` key takes precedence if both keys are present. These changes primarily affect the `sourcemaps inject` command, which will now place the debug ID in the `"debugId"` field rather than the `"debug_id"` field. The `sourcemaps upload` command is also affected, as sourcemaps will be rewritten with `"debugId"` rather than `"debug_id"`. Previously, rewriting preserved the key being used; if a sourcemap contained both keys, both would have been preserved after rewriting, but after these changes, we emit only `"debugId"`. For example, if a sourcemap contains only the `"debug_id"` key, the rewritten sourcemap will have that key in `"debugId"` instead; however, if a sourcemap contains both the `"debugId"` and the `"debug_id"` keys, the `"debug_id"` is completely stripped, and its value ignored. Closes #2221 Closes [CLI-44](https://linear.app/getsentry/issue/CLI-44/time-capsule-dont-open-before-nov-6-2025-emit-debugid-instead-of-debug)
bb32428 to
a7bea4b
Compare
| > Bundling completed in [..] | ||
| > Bundled 2 files for upload | ||
| > Bundle ID: 0b10dfbf-7d11-52a5-9107-d16f625896ad | ||
| > Bundle ID: b87a18c0-0d49-5771-bb15-cb1654bc9129 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bundle ID changes because the rewritten sourcemap contains debugId, not debug_id. Elsewhere, the hashes we are checking are changing for the same reason
| } | ||
|
|
||
| /// Tests that debug IDs can be found under the "debugId" field in sourcemaps. | ||
| /// Tests that debug IDs can be found under the old "debug_id" field in sourcemaps. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As debugId is now the default, I inverted this test as part of this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, just to understand this: the test fixture already contained both debug_id and debugId with different values, so you just need to change from one value to the other here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I guess what I wrote was a bit misleading, I also kinda forgot exactly what I did here 😅
The test previously was checking that if we had "debug_id" and "debugId", we select the "debug_id". I changed the test instead to check that if we only have "debug_id", we can still read the "debug_id". I don't have a test right now that checks the precedence (although, I think it is also fine to keep things that way, as I think this is more an internal detail of the sourcemap create).
"debug_id" still has the same value it had before. This is the relevant fixture, you can see that I just removed the "debugId".

Align debug ID injection with the relevant TC39 proposal by upgrading the
sourcemapcrate to 9.3.0, which serializes the Debug ID on a sourcemap under the"debugId"key, instead of the"debug_id"key. The crate still supports reading the"debug_id"key, but the"debugId"key takes precedence if both keys are present.These changes primarily affect the
sourcemaps injectcommand, which will now place the debug ID in the"debugId"field rather than the"debug_id"field. Thesourcemaps uploadcommand is also affected, as sourcemaps will be rewritten with"debugId"rather than"debug_id". Previously, rewriting preserved the key being used; if a sourcemap contained both keys, both would have been preserved after rewriting, but after these changes, we emit only"debugId". For example, if a sourcemap contains only the"debug_id"key, the rewritten sourcemap will have that key in"debugId"instead; however, if a sourcemap contains both the"debugId"and the"debug_id"keys, the"debug_id"is completely stripped, and its value ignored.Closes #2221
Closes CLI-44