Repository navigation
fix(error-tracking): match single-quoted and backticked ddDebugId in minified bundles - #529
Conversation
|
@melonsong @tyffical could you please take a look at this? |
|
@ilteoood Hello, thanks for the PR! I've passed this on internally for someone on Error Tracking to review. |
|
Thanks for the PR. 👍 The changes look good.
Documentation: capture group Note: We'll need to apply the same change to datadog-ci. |
|
Thank you @jhssilva, I've also added a non-regression test |
Some minifiers wrap the ddDebugId value in single quotes (e.g. ddDebugId:'<uuid>') or backticks (e.g. ddDebugId:`<uuid>`) instead of the double quotes produced by JSON.stringify(...). The previous regex only accepted double quotes around the value, so any bundle emitted with a different quote style failed extraction and triggered 'No debug ID found in any minified file. Aborting upload.' during sourcemap upload. Broaden the value quotes in DEBUG_ID_REGEX to ['"'``] and backreference the opening quote so the closing quote must match. Mirrors the change from DataDog/build-plugins#529. Signed-off-by: Corentin Girard <corentin.girard@datadoghq.com>
…es (#2539) Some minifiers wrap the ddDebugId value in single quotes (e.g. ddDebugId:'<uuid>') or backticks (e.g. ddDebugId:`<uuid>`) instead of the double quotes produced by JSON.stringify(...). The previous regex only accepted double quotes around the value, so any bundle emitted with a different quote style failed extraction and triggered 'No debug ID found in any minified file. Aborting upload.' during sourcemap upload. Broaden the value quotes in DEBUG_ID_REGEX to ['"'``] and backreference the opening quote so the closing quote must match. Mirrors the change from DataDog/build-plugins#529. Signed-off-by: Corentin Girard <corentin.girard@datadoghq.com>
|
@amortemousque is there anything else I should do here? |
|
@amortemousque @Scott-Meyer sorry guys for pinging you again, I see that a new version of the lib has been released without including this fix. |
|
hi @watson, sorry pinging you here as well to receive support on this merge. |
|
@ilteoood I can see that three of your commits are not signed, which is unfortunately blocking us from merging the PR. Would you be able to sign all the commits in your PR? If not, let me know and I can see if there's a way we can sign them for you. But to land this quicker, it's best if you sign them yourself |
Some minifiers wrap the ddDebugId value in single quotes (e.g. `ddDebugId:'<uuid>'` instead of `ddDebugId:"<uuid>"`). The previous regex only accepted double quotes around the value, so any bundle emitted with single quotes failed extraction and triggered `No debug ID found in any minified file. Aborting upload.` during sourcemap upload (issue DataDog#528). Loosen the value quotes to a ["'"] character class so both quote styles are accepted, while keeping the existing flexibility around the key itself.
Broaden the value quote class in DEBUG_ID_RX to also include backticks, since some minifiers can emit the injected value as a template literal-style string (`ddDebugId:\`<uuid>\``) which the previous regex would not match. Add a regression test covering the new backticked case.
Capture the opening quote and backreference it so a mismatched closing quote (e.g. ddDebugId:'<uuid>") is no longer extracted as a debug ID.
adae3da to
2e5213e
Compare
|
@watson it should be done now |
|
@jakub-g do you mind adding a review as well on behalf of the |
|
Ping @jakub-g |
There was a problem hiding this comment.
@ilteoood thanks for the PR! and apologies for the delay. The PR LGTM.
I will make a follow-up PR with some further fixes, unrelated to original issue, but fixing some adjacent possible problems.
In the meantime, I think we can merge this PR. Let's wait for CI.
|
I need to get some additional ✅ from codeowning teams to merge it; asking around (not sure why GitHub didn't dispatch those reviews earlier, weird). |
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
|
c3eb959
into
DataDog:master
Summary
Fixes #528 — sourcemap upload fails with
No debug ID found in any minified file. Aborting upload.even when the bundled output contains theddDebugIdliteral.Root cause
Some minifiers emit the injected value wrapped in single quotes or backticks rather than the double quotes produced by
JSON.stringify(...). Examples include:ddDebugId:'<uuid>'(single-quoted string)ddDebugId:\`` (template-literal-style string)"ddDebugId":'<uuid>'(mixed)The previous extraction regex only accepted double quotes around the value, so any bundle emitted with a different quote style failed extraction and aborted the upload.
Change
In
packages/plugins/error-tracking/src/sourcemaps/debugId.ts, broaden the value portion ofDEBUG_ID_RXto accept",'and`while keeping the existing flexibility around the optional quotes on the key:Added three regression tests in
debugId.test.tsto lock in the new behavior:ddDebugId:'<uuid>')"ddDebugId":'<uuid>')ddDebugId:``)Verification
yarn test:unit packages/plugins/error-tracking/src/sourcemaps/debugId.test.ts— all 11 tests pass (8 pre-existing + 3 new)yarn test:unit packages/plugins/error-tracking— 83 tests across 7 suites passyarn eslint --quiet <changed files>— cleanyarn prettier --check <changed files>— cleanyarn workspace @dd/error-tracking-plugin typecheck— clean