Skip to content

fix(core,browser): Handle errors from other realms - #22926

Open
davidmurdoch wants to merge 1 commit into
getsentry:developfrom
davidmurdoch:david/fix-cross-realm-error-detection
Open

fix(core,browser): Handle errors from other realms#22926
davidmurdoch wants to merge 1 commit into
getsentry:developfrom
davidmurdoch:david/fix-cross-realm-error-detection

Conversation

@davidmurdoch

@davidmurdoch davidmurdoch commented Jul 31, 2026

Copy link
Copy Markdown

Some event-processing paths failed to recognize errors created in another JavaScript realm. This preserves linked causes and AggregateError children, recognizes error-valued object properties, and applies fetch TypeError hostname enhancement across realm boundaries.

Root cause

instanceof Error, instanceof TypeError, and equivalent constructor-based checks depend on prototype identity. Errors from iframes, workers, or other realms have different intrinsic constructors even though they are genuine errors.

These paths now use the SDK’s existing realm-tolerant isError helper. The fetch path additionally checks error.name === "TypeError" to preserve its existing type restriction.

Regression coverage creates errors in a separate Node VM context and exercises both core and browser event builders, aggregate and linked errors, and fetch instrumentation.

Fixes #22925

Replace realm-sensitive Error constructor checks with the existing isError helper. Preserve the fetch TypeError restriction by checking the error name, and add cross-realm regression coverage.

Co-Authored-By: OpenAI Codex <codex@openai.com>
@davidmurdoch
davidmurdoch marked this pull request as ready for review July 31, 2026 20:58
@davidmurdoch
davidmurdoch requested a review from a team as a code owner July 31, 2026 20:58
@davidmurdoch
davidmurdoch requested review from logaretm and msonnb and removed request for a team July 31, 2026 20:58
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.

Cross-realm Error objects are not recognized in event processing

1 participant