fix(sdk): drop handled third-party errors in beforeSend to reduce alert noise#119453
Draft
billyvg wants to merge 1 commit into
Draft
fix(sdk): drop handled third-party errors in beforeSend to reduce alert noise#119453billyvg wants to merge 1 commit into
billyvg wants to merge 1 commit into
Conversation
The `thirdPartyErrorFilterIntegration` is configured with `apply-tag-if-contains-third-party-frames`, which tags events as `third_party_code: True` but does not drop them. This causes alerts to fire for errors originating from browser extensions or injected scripts that are already caught by React ErrorBoundaries and are not actionable. Add `isHandledThirdPartyError` to filter out events where all exceptions are handled and the event is tagged as third-party code. Unhandled third-party errors are kept since they may still crash the page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
This PR was created in response to a Sentry webhook alert received by the Claude automated session: https://claude.ai/code/session_01DoEYiubDpVgZv6GepfzYtd
Problem
A Sentry alert fired for event
b37780c91da546a9a209ccf4f14d43f5— aTypeError: Converting circular structure to JSONon the/unsubscribe/issue/:id/transaction.Evidence this is browser extension noise, not a Sentry bug:
third_party_code: TruebythirdPartyErrorFilterIntegrationhandled: yes— caught by React's ErrorBoundary before surfacing<anonymous>code (classic browser extension injection pattern), not Sentry's own source filesJSON.stringifyon anHTMLAnchorElementthat had React fiber nodes attached (__reactFiber$...), a circular-reference pattern exclusively caused by external scripts trying to serialize DOM elements that React has hydrateds1.sentry-cdn.com/...) are React's reconciler responding to the DOM mutation, not the root causeRoot Cause
thirdPartyErrorFilterIntegrationis configured withbehaviour: 'apply-tag-if-contains-third-party-frames', which tags events asthird_party_code: Truebut does not drop them. Handled third-party errors are therefore sent to Sentry and can trigger alerts, even though they provide no actionable signal.Fix
Add
isHandledThirdPartyErrorpredicate tobeforeSendthat returnsnull(drops the event) when:mechanism.handled !== false(the error was caught), ANDthird_party_code: TrueUnhandled third-party errors are intentionally preserved — they can still crash the page and may be worth investigating.
This is consistent with existing
beforeSendfilters (isFilteredRequestErrorEvent,isEventWithFileUrl,isNullTupleUnhandledRejectionEvent) that drop other categories of unactionable noise.Changes
static/app/bootstrap/initializeSdk.tsx: AddisHandledThirdPartyErrorfilter and wire intobeforeSendstatic/app/bootstrap/initializeSdk.spec.tsx: Add unit tests covering all four cases (handled+third-party, unhandled+third-party, handled+first-party, no exception)Generated by Claude Code