Skip to content

fix(error-tracking): match single-quoted and backticked ddDebugId in minified bundles - #529

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 5 commits into
DataDog:masterfrom
ilteoood:ilteoood/fix-528-double-quoted-debug-id
Oct 22, 2026
Merged

gh-worker-dd-mergequeue-cf854d[bot] merged 5 commits into
DataDog:masterfrom
ilteoood:ilteoood/fix-528-double-quoted-debug-id

Conversation

@ilteoood

@ilteoood ilteoood commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #528 — sourcemap upload fails with No debug ID found in any minified file. Aborting upload. even when the bundled output contains the ddDebugId literal.

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 of DEBUG_ID_RX to accept ", ' and ` while keeping the existing flexibility around the optional quotes on the key:

// Before
const DEBUG_ID_RX = /"?ddDebugId"?:"([0-9a-fA-F-]{36})"/;
// After
const DEBUG_ID_RX = /"?ddDebugId"?:["'`]([0-9a-fA-F-]{36})["'`]/;

Added three regression tests in debugId.test.ts to lock in the new behavior:

  • unquoted key with single-quoted value (ddDebugId:'<uuid>')
  • quoted key with single-quoted value ("ddDebugId":'<uuid>')
  • unquoted key with backticked value (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 pass
  • yarn eslint --quiet <changed files> — clean
  • yarn prettier --check <changed files> — clean
  • yarn workspace @dd/error-tracking-plugin typecheck — clean

@ilteoood
ilteoood requested a review from a team as a code owner September 30, 2026 15:10
@ilteoood
ilteoood requested review from jakub-g and removed request for a team September 30, 2026 15:10
@ilteoood ilteoood changed the title fix(error-tracking): match single-quoted debug-id in minified bundles fix(error-tracking): match single-quoted and backticked ddDebugId in minified bundles Sep 30, 2026
@ilteoood

ilteoood commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

@melonsong @tyffical could you please take a look at this?

@melonsong

Copy link
Copy Markdown
Member

@ilteoood Hello, thanks for the PR! I've passed this on internally for someone on Error Tracking to review.

@jhssilva

jhssilva commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Thanks for the PR. 👍 The changes look good.
One suggestion: Could we enforce that the opening and closing quotes match, using a capture group and backreference?

const DEBUG_ID_RX = /"?ddDebugId"?:(["'])([0-9a-fA-F-]{36})\1/;`

Documentation: capture group

Note: We'll need to apply the same change to datadog-ci.

@ilteoood

ilteoood commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Thank you @jhssilva, I've also added a non-regression test
I've also opened the same PR into the datadog-ci repo

Drarig29 pushed a commit to ilteoood/datadog-ci that referenced this pull request Oct 2, 2026
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>
Drarig29 pushed a commit to DataDog/datadog-ci that referenced this pull request Oct 2, 2026
…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>
@ilteoood

ilteoood commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

@amortemousque is there anything else I should do here?

@ilteoood

ilteoood commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

@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.
It would be awesome if this could be released soon, to avoid relying on an internal package patch.

@ilteoood

Copy link
Copy Markdown
Contributor Author

hi @watson, sorry pinging you here as well to receive support on this merge.

@watson

watson commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

@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.
@ilteoood
ilteoood force-pushed the ilteoood/fix-528-double-quoted-debug-id branch from adae3da to 2e5213e Compare October 13, 2026 14:24
@ilteoood

Copy link
Copy Markdown
Contributor Author

@watson it should be done now

@watson

watson commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

@jakub-g do you mind adding a review as well on behalf of the build-plugins team?

@ilteoood

Copy link
Copy Markdown
Contributor Author

Ping @jakub-g

@jakub-g jakub-g left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

@jakub-g
jakub-g requested a review from a team October 22, 2026 10:24
@jakub-g

jakub-g commented Oct 22, 2026

Copy link
Copy Markdown
Member

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).

@crousseaux crousseaux left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jakub-g
jakub-g enabled auto-merge October 22, 2026 10:48
@jakub-g
jakub-g disabled auto-merge October 22, 2026 10:54
@jakub-g

jakub-g commented Oct 22, 2026

Copy link
Copy Markdown
Member

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-10-22 10:58:23 UTC ℹ️ Start processing command /merge


2026-10-22 10:58:28 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in master is approximately 2m (p90).


2026-10-22 10:59:49 UTC ℹ️ MergeQueue: This merge request was merged

@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit c3eb959 into DataDog:master Oct 22, 2026
9 checks passed
@ilteoood
ilteoood deleted the ilteoood/fix-528-double-quoted-debug-id branch October 23, 2026 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No debug ID found in any minified file. Aborting upload.

8 participants