fix(relay): filter client-abandoned WS upgrade errors from Sentry
Merged
SA
4mo ago+6+6+0123456789-2-2-0123456789
Summary
RELAY-5 (TypeError: upgrade requires a Request object, 515 occurrences since June) is a client-gone race, not a relay fault:
- A WS upgrade request hits the relay; the auth middleware awaits JWT verification +
checkHostAccess(network round-trips) before@hono/node-wscompletes the handshake. - The client disconnects during that window.
- Bun's
node:wsshim (completeUpgrade) then callsserver.upgrade(socket[kBunInternals], …), but the underlying BunRequestwas released with the connection —server.upgrade(undefined)throws, surfacing as an unhandled rejection.
The client is gone either way, so this drops the event in beforeSend alongside the TunnelLifecycleError churn filter added in #6080. The process already survives these via the suppressed unhandledRejection handler; this just stops the Sentry noise.
Fixes RELAY-5
Test plan
bun run lintclean, relaytypecheckclean- After merge (relay auto-deploys on main): confirm RELAY-5 stops receiving events
https://claude.ai/code/session_012u6VZtfQgoTh8qS4NqCb7e
Summary by cubic
Filters client-abandoned WebSocket upgrade errors from Sentry in the relay to reduce noise. Fixes RELAY-5.
- Bug Fixes
- Ignore
node:ws"upgrade requires a Request object" exceptions in SentrybeforeSend, which happen when clients disconnect during async JWT/host access checks before the@hono/node-wshandshake completes.
- Ignore
Summary by CodeRabbit
- Bug Fixes
- Reduced unnecessary error reports by filtering out known upgrade-related errors.
- Continued suppressing expected tunnel lifecycle errors from error monitoring.