Repository navigation
fix(sentry): stop reporting browser AbortError noise - #931
Conversation
Client unhandledrejection of AbortError (user navigated away / superseded SPA fetch) is expected and not actionable. Filter it in browser beforeSend so KODY-CLOUDFLARE-23 and siblings stop opening Sentry issues.
📝 WalkthroughWalkthroughBrowser abort detection utilities and tests were added, then integrated into Sentry initialization and client exception capture to filter abort-related events and exceptions. ChangesBrowser abort filtering
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant SentryClient
participant Sentry
participant beforeSend
participant AbortFilter
SentryClient->>Sentry: initialize with beforeSend
Sentry->>beforeSend: send event and original exception
beforeSend->>AbortFilter: filterBrowserAbortSentryEvent(event, originalException)
AbortFilter-->>beforeSend: null or unchanged event
beforeSend-->>Sentry: return filtered event
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
🔎 Preview deployed: https://kody-pr-931.kody-a99.workers.dev Worker: Mocks:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/worker/client/sentry-browser-filters.ts`:
- Around line 30-35: Restrict isBrowserAbortErrorMessage to exact known
abort-message variants instead of broadly matching any “AbortError:” prefix,
while preserving the existing exact strings. In
packages/worker/client/sentry-browser-filters.ts lines 30-35, replace the
startsWith check with explicit allowed variants; in
packages/worker/client/sentry-browser-filters.node.test.ts lines 9-23, add an
assertion that “AbortError: The operation was aborted due to timeout.” returns
false.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: ae0fa542-106d-4695-85f2-f15c75d1a535
📒 Files selected for processing (3)
packages/worker/client/sentry-browser-filters.node.test.tspackages/worker/client/sentry-browser-filters.tspackages/worker/client/sentry-client.ts
Address review feedback: drop the AbortError: prefix catch-all so timeout wording is not filtered; keep exact Chromium/Firefox abort texts only.
Add the CodeRabbit regression for prefixed timeout wording, and remove the bare "aborted" message match which is broader than needed (name checks cover DOMException AbortError).
Summary
Sentry KODY-CLOUDFLARE-23 reported a single browser
AbortError: The user aborted a request.on/oauth/authorizeviaauto.browser.global_handlers.onunhandledrejection(Edge 150, no stack frames,DOMException.code=20).That is expected Chromium/Edge behavior when an in-flight
fetchis aborted (superseded SPA navigation, user leaving the page, etc.). It is not an actionable product defect, and without a client filter it will keep reopening issues whenever users abort requests.Change
beforeSendfilter (filterBrowserAbortSentryEvent) that drops AbortError-named exceptions and exact well-known abort message strings (AbortError: The user aborted a request.,The operation was aborted., etc.). Timeout wording is intentionally not matched.captureClientExceptionas a belt-and-suspenders path.TypeError) and timeout abort wording still report.Worker-side
sentry-options.tscannot help here: browser envelopes are forwarded by/sentry-tunnelwithout going through WorkerbeforeSend.Outcome
filtered — ship the filter, then mark the Sentry issue ignored once deployed.
Siblings (KODY-CLOUDFLARE-17 Navigation API, sandbox timeout, MCP validation) do not share this root cause and are left alone.
System recap — composes existing primitives (low risk)
Mode: recap · Base:
main@c1687e26· Head: latest on branchClassification: composes — no primitives added or changed; wires a narrow
beforeSendfilter into the existing browser Sentry client.Primitives touched
app-uibeforeSenddrops AbortError noiseSystem map
Browser AbortErrors are dropped in the client SDK before the envelope reaches the same-origin tunnel.
Legend: green = composes (wiring only) · amber = extended by this PR · red = new primitive · gray = context (unchanged, included only when an edge crosses it).
Before / after
AbortError: The user aborted a request.unhandledrejectionbeforeSendTypeError/ app bugsSummary by CodeRabbit
AbortError), and validation that non-abort events remain unchanged.