Describe the bug
When the signal WebSocket errors after connection (common in Firefox on network drops/reloads), an unhandled promise rejection leaking a raw DOM Event escapes the SDK.
Root cause:
WebSocketStream.ts: ws.onerror errors the controller with the raw Event (controller.error(e)).
SignalClient.ts: handleSignalConnected() triggers startReadingLoop() fire-and-forget without a .catch().
startReadingLoop lacks a try/catch around signalReader.read(), causing the stream rejection to leak.
Side note: Clean closes never call controller.close(), causing read() to hang indefinitely.
Impact
Error trackers (Sentry, PostHog) capture stackless, contentless exceptions ("Event captured as exception with keys: isTrusted"). This is a top production error (~78% Firefox) during reconnects.
Reproduction
- Connect to a room in Firefox.
- Drop connectivity or reload the page.
- Observe
unhandledrejection with reason instanceof Event === true.
Expected behavior
Post-connect WebSocket errors should normalize to a ConnectionError and route to handleWSError/handleOnClose without unhandled rejections.
Environment
Reproduction
See the bug description.
Logs
System Info
Severity
annoyance
Additional Information
No response
Describe the bug
When the signal WebSocket errors after connection (common in Firefox on network drops/reloads), an unhandled promise rejection leaking a raw DOM
Eventescapes the SDK.Root cause:
WebSocketStream.ts:ws.onerrorerrors the controller with the rawEvent(controller.error(e)).SignalClient.ts:handleSignalConnected()triggersstartReadingLoop()fire-and-forget without a.catch().startReadingLooplacks a try/catch aroundsignalReader.read(), causing the stream rejection to leak.Side note: Clean closes never call
controller.close(), causingread()to hang indefinitely.Impact
Error trackers (Sentry, PostHog) capture stackless, contentless exceptions (
"Event captured as exception with keys: isTrusted"). This is a top production error (~78% Firefox) during reconnects.Reproduction
unhandledrejectionwithreason instanceof Event === true.Expected behavior
Post-connect WebSocket errors should normalize to a
ConnectionErrorand route tohandleWSError/handleOnClosewithout unhandled rejections.Environment
Reproduction
See the bug description.
Logs
System Info
Severity
annoyance
Additional Information
No response