-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CONNECTION ERROR: Couldn't connect to node on WS. #3816
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment. |
This problem happens regularly. There is a hint of what could be happening in the Infura Community forums:
https://community.infura.io/t/internal-logs-subscription-error/2992/3 IMO the issue should be reopened. cc/ @spacesailor24 |
Thank you @Wyctus for making this issue, we've actually experienced this with our test suite and couldn't figure out why Thank you @gabmontes for bringing this back from the dead 🧟 Have either of y'all tried this fix: const Web3 = require('web3');
const util = require('util');
async function main(){
const web3 = new Web3(new Web3.providers.WebsocketProvider(
'wss://ropsten.infura.io/ws/v3/<infura-project-id>', // <-- Put your projectID here
{
clientConfig: {
maxReceivedFrameSize: 100000000,
maxReceivedMessageSize: 100000000,
}
}
));
const block = await web3.eth.getBlock(599275, true);
console.log(util.inspect(block))
}
main()
.then(() => process.exit(0))
.catch(err => {
console.log(err);
process.exit(1)
}); Mentioned here |
Thank you @spacesailor24 for the idea. I started to run my original code with your config. I will run it for a couple of hours to see what happens. The error always happened really randomly, sometimes worked perfectly for 2-3 days, so I don't know what will happen now. If I don't experience the issue for a couple of hours, it doesn't mean it's gone. |
I finished an 11 hour long continous testing. No error so far. I will keep running the test tommorow. |
@spacesailor24 Update: The test was running after the initial problem for 12 hours without any issue. |
@Wyctus Thank you for the updates |
Closing the issue for now, please reopen if the error persists |
Error: CONNECTION ERROR: Couldn't connect to node https://eth-goerli.g.alchemy.com/v2/API_KEY I'm facing this problem from two weeks. Any on can have solution then please tell me. |
Me too. Anyone Help? Below is error message. InvalidConnection: host => new Error(CONNECTION ERROR: Couldn't connect to node ${host}.), |
Use https instead of wss. It worked for me fine. |
Thanks, but I didn't use wss. I use the HttpProvider. |
This error started to happen to me regularly for a couple of weeks now. I can't tell the reason, seems to be totally random. Maybe it's a problem with Infura, since the error pops up on two different machines at the same time (they are running the same code).
My code is simply listening to some events on a some contracts. Sometimes it works for a day without any problem. But after it happens I can't reconnect for 30-60 minutes.
Looks pretty similar to #1646.
Expected behavior
The connection should stay open.
Actual behavior
It disconnects and can't reconnect for a long time.
Steps to reproduce the behavior
The
contracts
contains around 400 elements.Logs
Environment
Machine1:
Machine2:
The text was updated successfully, but these errors were encountered: