-
Notifications
You must be signed in to change notification settings - Fork 242
Open
Labels
bugSomething isn't workingSomething isn't working
Description
[REQUIRED] Environment
- Runtime: Node.js (server-side)
- Alchemy SDK version: 3.6.5
[REQUIRED] Describe the problem
With Alchemy SDK v3.6.5 we are seeing intermittent uncaught exceptions during WebSocket reconnections. The error originates inside the SDK and is not related to application code or ethers.
Error:
TypeError: Cannot read properties of undefined (reading 'subscription')
Failing location:
alchemy-sdk/src/api/alchemy-websocket-provider.ts:500:39
Failing line:
const physicalId = message.params.subscription;During reconnection, a message can arrive before subscriptions are fully re-established. In that case message.params is undefined, but handleMessage accesses it without validation, causing an uncaught exception.
How to reproduce
- Use Alchemy SDK v3.6.5 with WebSocket subscriptions.
- Let the WebSocket disconnect and auto-reconnect.
- A message is received during the reconnection window.
handleMessageruns and throws the error above.
This is intermittent and timing-related, but reproducible under network instability.
Relevant code or sample repro
No minimal repro available. Observed in production.
Suggested defensive fix:
if (!message.params || !message.params.subscription) {
return;
}This would prevent crashes when out-of-order or malformed messages arrive during reconnection.
elderapo and PabloPerezAguilo
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working