Skip to content

fix(sentry): drop benign closed-channel postMessage error on client - #217

Merged
harlan-zw merged 1 commit into
mainfrom
fix/issue-174
Sep 14, 2026
Merged

harlan-zw merged 1 commit into
mainfrom
fix/issue-174

Conversation

@harlan-zw

Copy link
Copy Markdown
Collaborator

🔗 Linked issue

Closes #174

❓ Type of change

  • 📖 Documentation
  • 🐞 Bug fix
  • 👌 Enhancement
  • ✨ New feature
  • 🧹 Chore
  • ⚠️ Breaking change

📚 Description

Client Sentry reports a benign tab-close race as an unhandled error (SKILLD-12). nuxt-skew-protection's multi-tab plugin closes its BroadcastChannel on app:error. A version update that is already in flight can still post to the closed channel, and Chrome rejects the post:

InvalidStateError: Failed to execute 'postMessage' on 'BroadcastChannel': Channel is closed

The client config now has a beforeSend that drops this one message. It uses the same shape as the server plugin: it checks hint.originalException and the serialized exception values. The new isClosedBroadcastChannelError predicate in shared/sentry.ts matches the exact message from the latest Sentry event, so these still reach Sentry:

  • a closed-channel postMessage on another target, such as a Worker
  • a DataCloneError from the same BroadcastChannel
  • a generic InvalidStateError

The only events in Sentry come from Chrome. Firefox and Safari word the error differently, so they are not matched. If they start to show up, add their exact messages.

Checks: pnpm vitest run test/unit/sentry-cache-write-filter.test.ts passes 17 tests, 4 of them new. The new tests failed before the fix. pnpm typecheck and eslint on the 3 files exit 0.

https://claude.ai/code/session_01AkTC7eqkf2tpVZJhYDU2YL

nuxt-skew-protection's multi-tab plugin closes its BroadcastChannel on
app:error, and a version update already in flight can still post to it.
Chrome rejects that post with InvalidStateError (SKILLD-12). The tab is
erroring or closing anyway, so the event is noise. The client beforeSend
now drops that exact message and keeps every other error.

Claude-Session: https://claude.ai/code/session_01AkTC7eqkf2tpVZJhYDU2YL
@harlan-github-agent harlan-github-agent Bot added harlan-agent-running An Agent holds a Task on this issue or pull request right now. harlan-agent-review-required Pull request triage requires an adversarial Review for this head commit. labels Sep 14, 2026
@harlan-github-agent

harlan-github-agent Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

🤖 MERGED

Harlan Agent Kit posted this automated review. It is not Harlan's personal review or approval. AI open source policy. Last updated: 2026-09-14 14:52 UTC.

GitHub merged this pull request.

No material findings were recorded.

781c1417-0fbc-42eb-8765-c195da2d0932

@harlan-github-agent harlan-github-agent Bot added harlan-agent-running An Agent holds a Task on this issue or pull request right now. harlan-agent-review-required Pull request triage requires an adversarial Review for this head commit. harlan-agent-pending The automated Review is waiting on a gate for this head commit. and removed harlan-agent-running An Agent holds a Task on this issue or pull request right now. harlan-agent-review-required Pull request triage requires an adversarial Review for this head commit. labels Sep 14, 2026
@harlan-zw
harlan-zw merged commit fbb84ae into main Sep 14, 2026
5 checks passed
@harlan-github-agent harlan-github-agent Bot removed the harlan-agent-pending The automated Review is waiting on a gate for this head commit. label Sep 14, 2026
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.

Drop benign closed-channel postMessage error from client Sentry

1 participant