Skip to content

fix(client): filter Fathom removeChild-on-null Sentry noise (KODY-CLOUDFLARE-3Q) - #1232

Merged
kody-bot merged 2 commits into
mainfrom
cursor/sentry-triage-kody-cloudflare-kody-cloudflare-3q-a817
Aug 5, 2026
Merged

kody-bot merged 2 commits into
mainfrom
cursor/sentry-triage-kody-cloudflare-kody-cloudflare-3q-a817

Conversation

@kentcdodds

@kentcdodds kentcdodds commented Aug 5, 2026 •

Copy link
Copy Markdown
Owner

Summary

Filters browser Sentry noise from KODY-CLOUDFLARE-3Q (7653117289).

Fathom Analytics (cdn.usefathom.com/script.js) inserts a temporary <img> beacon and removes it in load/error handlers via img.parentNode.removeChild(img). After SPA navigation the beacon can already be detached, so parentNode is null and Chromium throws:

TypeError: Cannot read properties of null (reading 'removeChild')

Sentry's browserapierrors.addEventListener wrapper captures that third-party throw. Not a Kody product bug and not reasonably fixable in app code (external script).

Change

  • Add filterFathomRemoveChildNullSentryEvent in sentry-browser-filters.ts
  • Match requires both the Chromium removeChild-on-null TypeError text and a stack frame whose hostname is cdn.usefathom.com (so real app removeChild bugs still report)
  • Wire into filterBrowserSentryEvent; unit tests cover drop / keep / hostname lookalike cases

Outcome

filtered — ship this filter, then ignore the Sentry issue so it stops paging.

No sibling unresolved issues share this Fathom / removeChild signature.

System recap — composes existing primitives (low risk)

Mode: recap · Base: main @ bd33593e · Head: 2888b905

Classification: composes — narrow browser beforeSend filter on the existing client Sentry path; no new primitives or contracts.

Primitives touched

Primitive Group Impact
app-ui surfaces composes — extends client Sentry noise filter list only

System map

Browser errors still flow through the existing client Sentry init; this PR only drops one third-party Fathom signature in beforeSend.

Legend: green = composes (wiring only) · amber = extended by this PR · red = new primitive · gray = context (unchanged, included only when an edge crosses it).

flowchart LR
	appUi["app-ui<br/>Browser app (Remix 3)"]:::touched
	sentry["Sentry browser SDK<br/>beforeSend"]:::untouched
	appUi -->|"filterFathomRemoveChildNullSentryEvent"| sentry
	classDef touched fill:#1a7f37,color:#fff
	classDef extended fill:#9a6700,color:#fff
	classDef added fill:#cf222e,color:#fff
	classDef untouched fill:#57606a,color:#fff
Loading
Open in Web Open in Cursor 

Summary by CodeRabbit

  • Bug Fixes
    • Reduced browser error noise by filtering a specific Fathom Analytics removeChild error.
    • Continued reporting similar application errors and unrelated analytics errors normally.
    • Improved browser error filtering for events with nested exception stack frames.
    • Added coverage to help ensure valid browser errors remain visible in monitoring.

Drop browser events for KODY-CLOUDFLARE-3Q where Fathom's beacon img
handler calls parentNode.removeChild after the node was already detached.
Match requires both the Chromium removeChild-null TypeError text and a
cdn.usefathom.com stack frame so app removeChild bugs still report.

Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
@coderabbitai

coderabbitai Bot commented Aug 5, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 80e9ed93-91c4-436c-9eda-2e2946470244

📥 Commits

Reviewing files that changed from the base of the PR and between 733a3f4 and 2888b90.

📒 Files selected for processing (3)
  • packages/worker/client/sentry-browser-filters.node.test.ts
  • packages/worker/client/sentry-browser-filters.ts
  • packages/worker/client/sentry-init.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/worker/client/sentry-browser-filters.node.test.ts
  • packages/worker/client/sentry-init.ts
  • packages/worker/client/sentry-browser-filters.ts

📝 Walkthrough

Walkthrough

Changes

The browser Sentry filters now inspect nested exception stack frames for URLs. They discard the exact null-removeChild error only when a Fathom CDN frame is present. Tests cover matching and non-matching events, and the Sentry comment documents the case.

Fathom Sentry filtering

Layer / File(s) Summary
Stack-frame URL detection
packages/worker/client/sentry-browser-filters.ts
Sentry event types and exception traversal now expose stack-frame URLs from nested exceptions.
Fathom filter integration
packages/worker/client/sentry-browser-filters.ts, packages/worker/client/sentry-init.ts
The filter matches the exact null-removeChild error with a Fathom CDN frame and applies it through the browser event filter. The Sentry filter comment records the ignored error.
Fathom filter validation
packages/worker/client/sentry-browser-filters.node.test.ts
Tests verify that matching Fathom events are removed and similar or unrelated events remain.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: filtering Fathom removeChild-on-null Sentry noise.
Description check ✅ Passed The description explains the intent, changes, outcome, and testing coverage, with system impact documented in the recap.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/sentry-triage-kody-cloudflare-kody-cloudflare-3q-a817

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kody-bot
kody-bot marked this pull request as ready for review August 5, 2026 03:42
@github-actions

github-actions Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

🔎 Preview deployed: https://kody-pr-1232.kody-a99.workers.dev

Worker: kody-pr-1232
D1: kody-pr-1232-db
KV: kody-pr-1232-oauth-kv

Mocks:

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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 221-229: Update isFathomAnalyticsStackFrameUrl to parse the input
URL and return true only when its hostname equals cdn.usefathom.com, rather than
matching a URL substring; preserve safe handling for invalid URLs. Add a
regression case covering a non-Fathom hostname using /cdn.usefathom.com/ in its
path.

In `@packages/worker/client/sentry-init.ts`:
- Around line 32-36: Update the issue identifier in the Sentry filter comment
near filterBrowserSentryEvent from KODY-CLOUDFLARE-23 to KODY-CLOUDFLARE-3Q,
leaving the surrounding references unchanged.
🪄 Autofix

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: c5c5ec58-91b5-4f22-bba0-94e71622ffb8

📥 Commits

Reviewing files that changed from the base of the PR and between bd33593 and 733a3f4.

📒 Files selected for processing (3)
  • packages/worker/client/sentry-browser-filters.node.test.ts
  • packages/worker/client/sentry-browser-filters.ts
  • packages/worker/client/sentry-init.ts

Comment thread packages/worker/client/sentry-browser-filters.ts Outdated
Comment thread packages/worker/client/sentry-init.ts Outdated
Parse frame URLs and compare hostname to cdn.usefathom.com so a
path-substring lookalike on heykody.dev cannot false-positive the drop.

Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
@kody-bot
kody-bot merged commit 9701196 into main Aug 5, 2026
14 of 16 checks passed
@kody-bot
kody-bot deleted the cursor/sentry-triage-kody-cloudflare-kody-cloudflare-3q-a817 branch August 5, 2026 04:00
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.

3 participants