Repository navigation
feat: parse JavaScript stack traces in the exception panel (HDX-5888) - #3534
Conversation
…-browser-exception-stacks
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: e139752 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
🟡 Tier 3 — StandardIntroduces new logic, modifies core functionality, or touches areas with non-trivial risk. Why this tier:
Review process: Full human review — logic, architecture, edge cases. Stats
|
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
| const MAX_PARSED_STACK_LENGTH = 64 * 1024; | ||
|
|
||
| const CAUSED_BY_REGEX = /^\s*Caused by: /; | ||
| const V8_FRAME_REGEX = /^\s*at /; |
There was a problem hiding this comment.
🔵 minor — Message lines that start with "at " are read as V8 frames
V8_FRAME_REGEX = /^\s*at / also matches message lines with no indent. For example, new Error('Invalid cart\nat least one item required') makes getHeaderLength end the header at at least one item required. That cuts the line out of the cause title, and the very permissive chromeRegex (sentryStackParser.ts) turns it into a fake frame with filename least one item required. Real V8 frames are always indented ( at), so use /^\s+at / here, and require the same indent before handing lines to the Chrome parser.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| }) => { | ||
| const firstException = exceptionValues[0]; | ||
|
|
||
| const shouldShowSourceMapFtux = useMemo(() => { |
There was a problem hiding this comment.
🔵 minor — shouldShowSourceMapFtux was rewritten but nothing reads it
Its only other mention is the commented-out {/* {shouldShowSourceMapFtux && <SourceMapsFtux />} */}, so the memo runs on every render for nothing. The diff rewrote it for the new stacktrace union type anyway. Delete the memo and the comment, or wire it up properly.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| <span>{' in '}</span> | ||
| <span | ||
| style={{ | ||
| background: '#ffffff10', |
There was a problem hiding this comment.
🔵 minor — Function-name chip uses a hard-coded white tint that vanishes in light theme
The rewritten in <function> chip still uses background: '#ffffff10', which is invisible on a light background. Use a semantic token such as var(--color-bg-muted) or var(--color-bg-hover), as the semantic design tokens convention asks.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
PR Review
4 finding(s): 🔴 0 critical · 🟠 0 major · 🔵 4 minor 3 posted as inline comment(s) on the changed lines. 1 listed below. Findings outside the changed lines1 minor
Severity is the reviewer's own estimate and is used for ordering, not filtering. No finding blocks merge automatically; a maintainer decides. |
Deep Review✅ No critical issues found. This is a well-scoped, well-tested visual change. The parser runs only on 🟡 P2 — recommended
🔵 P3 nitpicks (4)
Reviewers (6): correctness, adversarial, testing, maintainability, kieran-typescript, performance. Testing gaps:
Residual risk: The ported Sentry regexes run during render on client-controlled text; the 64 KB / 1 KB-per-line / 32-paren / 50-frame guards bound worst-case cost and the Sentry MIT + TraceKit provenance notices are complete and version-pinned, so this is noted rather than flagged. No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
E2E Test Results✅ All tests passed • 460 passed • 1 skipped • 1625s
Tests ran across 4 shards in parallel. |
…-browser-exception-stacks
Closes HDX-5888
Summary
Our new OTel JS SDKs send
exception.stacktraceas raw text, so the exception panel showed a text block. This parses it into frames onwebjs/nodejsrows and shows eachCaused by:error as a collapsible section. Oldparsed_stacktracerows and other languages are unchanged. This is just a visual change to the exceptions panel.Changes
Screenshots
Before
Old SDK error for example (as seen in traces browser). As you can see this is undisturbed and the old SDK works fine.

After
New Exceptions view panel (as seen on logs browser, where the SDKs send browser events)

Raw stack trace (note the source maps used this data in the previous screenshot, and that caused by was parsed and separated)

When source maps are unavailable:
When there's no a stack trace, only a message:
