Skip to content

fix(javascript): keep backtrace coordinates when source map lookup misses - #601

Merged
neSpecc merged 1 commit into
masterfrom
fix/javascript-sourcemap-miss-keeps-frame
Nov 2, 2026
Merged

neSpecc merged 1 commit into
masterfrom
fix/javascript-sourcemap-miss-keeps-frame

Conversation

@neSpecc

@neSpecc neSpecc commented Nov 2, 2026

Copy link
Copy Markdown
Member

Summary

  • When originalPositionFor does not find a generated position, source-map-js returns nulls. Those nulls were written onto the frame and sourceCode became [], so the catcher location was lost.
  • If originalLocation.source is missing, consumeBacktraceFrame now returns the original frame.
  • Covers the miss with a test that a mapped file and an unmapped line/column keep the catcher coordinates.

Fixes #600

Test plan

  • yarn jest workers/javascript/tests/index.test.ts -t "should keep the original frame|should parse source maps correctly"
  • Confirm a real event whose frame matches a release map but misses originalPositionFor still shows the original file, line, and column

…sses

source-map-js returns nulls for an unmapped position, and writing them onto the frame dropped the catcher location.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approved

There are no active review issues for the change preserving original backtrace frames when source-map lookups find no mapping.

No open issues 🎉

What changed in this PR

Preserves catcher-provided backtrace frames when source-map lookup finds no mapping, addressing #600 without overwriting the original location.

Changes:

  • Returns the original frame when originalLocation.source is missing.
  • Adds a regression test verifying that an unmapped position retains the original frame.
File Description
workers/​javascript/​tests/​index.test.ts Tests preservation of the original frame after a source-map lookup miss.
workers/​javascript/​src/​index.ts Adds an early return to prevent missing mappings from overwriting frame data.

Review effort: Balanced

@neSpecc
neSpecc merged commit 8c51698 into master Nov 2, 2026
6 checks passed
@neSpecc
neSpecc deleted the fix/javascript-sourcemap-miss-keeps-frame branch November 2, 2026 19:24
neSpecc added a commit that referenced this pull request Nov 2, 2026
…sses (#601) (#602)

source-map-js returns nulls for an unmapped position, and writing them onto the frame dropped the catcher location.

Co-authored-by: Peter <specc.dev@gmail.com>
Kuchizu added a commit that referenced this pull request Nov 2, 2026
* fix(javascript): keep backtrace coordinates when source map lookup misses (#601)

source-map-js returns nulls for an unmapped position, and writing them onto the frame dropped the catcher location.

* Escape Markdown in Telegram notification titles (#599)

* Escape Markdown in Telegram notification titles

* Pin current date in paymaster tests to avoid month overflow

* Escape project name in Telegram notification footer

---------

Co-authored-by: Peter <specc.dev@gmail.com>

---------

Co-authored-by: Peter <specc.dev@gmail.com>
Co-authored-by: Kuchizu <70284260+Kuchizu@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(javascript): failed source map lookup wipes backtrace coordinates

2 participants