Hi everyone, I have been running a job which runs every minute and checks for transactions against a set of contracts.
I run the same code against mainnet, rinkeby & ropsten but about 3 days ago ropsten started to kick back an error.
Error: CONNECTION ERROR: Couldn't connect to node on WS.
Code uses a websocket connection, we utilise web3js.1.0.37-beta
new Web3(new Web3.providers.WebsocketProvider(`wss://${network}.infura.io/ws/v3/${INFURA_API_KEY_V3}`));
It looks to be failing on the actual connection, I am running this in the hosted environment on google cloud and the job runs successfully for other networks.
I just ran a simple websocket test to get protocol version on ropsten, and I’m getting a connection and a response. Is there any more details you can provide? I have run into issues on firefox not being able to connect due to a header issues and well as certain version of web3js. (I tested on web3js.1.0.33)
Hi Guys, I have added more logging and still get this issue, here is my log out:
info: Connecting to INFURA web socket provider [wss://ropsten.infura.io/ws/v3/<MY_API_KEY>]
info: TXS Parser - Logging all TXS on network [ropsten]
info: TXS Parser - Last network block number of [4887580] for network [ropsten]
Preformatted textinfo: TXS Parser - Last processed block [4728912] for network [ropsten]
error: TXS Parser Error - failed to handle with block [4728956] for network [ropsten] Error: CONNECTION ERROR: Couldn't connect to node on WS.
at Object.InvalidConnection (/Users/jamesmorgan/Dropbox/workspace-blockrocket/known-origin-serverless-api/functions/node_modules/web3-core-helpers/src/errors.js:35:16)
at WebsocketProvider._timeout (/Users/jamesmorgan/Dropbox/workspace-blockrocket/known-origin-serverless-api/functions/node_modules/web3-providers-ws/src/index.js:249:48)
at W3CWebSocket.connection.onclose (/Users/jamesmorgan/Dropbox/workspace-blockrocket/known-origin-serverless-api/functions/node_modules/web3-providers-ws/src/index.js:149:15)
at W3CWebSocket._dispatchEvent [as dispatchEvent] (/Users/jamesmorgan/Dropbox/workspace-blockrocket/known-origin-serverless-api/functions/node_modules/yaeti/lib/EventTarget.js:107:17)
at W3CWebSocket.onClose (/Users/jamesmorgan/Dropbox/workspace-blockrocket/known-origin-serverless-api/functions/node_modules/websocket/lib/W3CWebSocket.js:228:10)
at WebSocketConnection.<anonymous> (/Users/jamesmorgan/Dropbox/workspace-blockrocket/known-origin-serverless-api/functions/node_modules/websocket/lib/W3CWebSocket.js:201:17)
at emitTwo (events.js:126:13)
at WebSocketConnection.emit (events.js:214:7)
at WebSocketConnection.drop (/Users/jamesmorgan/Dropbox/workspace-blockrocket/known-origin-serverless-api/functions/node_modules/websocket/lib/WebSocketConnection.js:473:14)
at /Users/jamesmorgan/Dropbox/workspace-blockrocket/known-origin-serverless-api/functions/node_modules/websocket/lib/WebSocketConnection.js:301:18
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
error: TXS Parser Error Error: CONNECTION ERROR: Couldn't connect to node on WS.
info: Execution took 42600 ms, user function completed successfully
The code is being run for a serverless function on google cloud so not in a browser, I am using latest web3 and V3 Infura API key.
It looks like this actual line that is failing from web3js is this: