ethers.js
ethers.js copied to clipboard
WS Subscriptions are not awaited, thus errors cannot be handled
Ethers Version
5.7.2
Search Terms
websocket, provider
Describe the Problem
Subscription to an event, i.e. newheads and logs may end up with error on provider side; since subscription is not awaited, errors cannot be handled and drops to "unhandled promise rejection"
Following _subscribe
s within _startEvent
should be await
ed
https://github.com/ethers-io/ethers.js/blob/0bfa7f497dc5793b66df7adfb42c6b846c51d794/packages/providers/src.ts/websocket-provider.ts#L248-L256
Code Snippet
No response
Contract ABI
No response
Errors
Unhandled Rejection: [object Promise], Error: Unsupported subcription: logs
Environment
node.js (v12 or newer)
Environment (Other)
No response