Skip to content

fix(web): drop opaque script error exceptions in posthog - #2551

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/posthog-error-investigation-f59d
Draft

fix(web): drop opaque script error exceptions in posthog#2551
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/posthog-error-investigation-f59d

Conversation

@cursor

@cursor cursor Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

PostHog showed new production volume on 2026-08-02 for Error: Script error. (5 occurrences / 2 users / 2 sessions), all Safari (desktop + iOS), all from the August email campaign (utm_source=email&utm_campaign=august), on /life and /week.

Every sample was synthetic, $exception_handled: false, and had no stack frames. Compass loads only same-origin /index.js as a module — real app exceptions report useful messages and frames. Opaque Script error. here is the browser sanitizing a cross-origin failure (extension / in-app browser / third-party inject), which matches the existing CefSharp / network-noise filter policy.

Also confirmed during triage: Selected event not found spiked earlier the same day and is already fixed/resolved by #2549 (merged ~3 minutes after last occurrence).

Change: drop $exception events whose value is exactly Script error. and that have no stack frames in filterPosthogBeforeSend. Keep any payload that somehow still has frames.

Simplicity

One exact-message check in the existing before_send filter, plus a frames guard so we never discard a stack-bearing event.

Automated validation

  • Triaged active PostHog issues (7d / 48h / 30d; users + occurrences + first_seen).
  • Sampled all 5 Script error events; reconstructed both affected session timelines.
  • Confirmed production hosts only same-origin module scripts in index.html.
  • Confirmed healthy traffic (~45 users on 2026-08-02).

Independent review

Focused diff review of the filter + tests: exact-message match, frames guard, no change to capture_console_errors / ApiError paths.

Test plan

bun test:web -- packages/web/src/auth/posthog/posthog-exception-filter.util.test.ts
bun lint

Remaining risk

  • Filter only applies after deploy; existing issue may still receive events until then — resolve/suppress after volume stops.
  • If a future same-origin bug somehow surfaces only as Script error. with zero frames (should not happen for this app's script loading), it would be dropped; actionable app bugs still report real messages + frames.

Error signatures addressed

  • Error: Script error. (issue)
Open in Web View Automation 

Safari-only "Script error." events from email-campaign traffic have no
stack frames and cannot be attributed to app code. Filter them in
before_send like other known-unactionable noise, while keeping any
payload that still carries frames.

Co-authored-by: Tyler Dane <tyler-dane@users.noreply.github.com>
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.

1 participant