1

After a few hours the socket to Infura seems to drop and we get the error, Error: Connection error: Connection is not open on send() Why does this happen or what is the best way to solve it?

version: 1.0.0-beta.52

This is how the app connects.

const contractConfig = require('./contract_config.js')

if (process.argv[3] == 'ropsten') {
  var network = 'ropsten';
} else {
  var network = 'main'
}
var web3 = new Web3(new Web3.providers.WebsocketProvider(contractConfig[network].url));
3
  • Are we suppoed to guess the contents of your contract_config.js and the value of process.argv[3]??? Jun 5, 2019 at 7:37
  • The standard Infura web socket url wss://ropsten.infura.io/ws/v3/KEY. It works for some hours before the error. Maybe this would be better posted in a github issue.
    – Eddie
    Jun 5, 2019 at 8:01
  • Ah forgot to search github. github.com/ethereum/web3.js/issues/1965#issuecomment-437269711
    – Eddie
    Jun 5, 2019 at 8:20

1 Answer 1

0

I know that error happened on web3, but I got here even though searching for the solution on ethers. It can help others.

If you are using an overloaded function with ethers, you need to specify this function.

Example:

// initialize(string _name, string _symbol);
contract.initialize(name, symbol).then( ... );
contract["initialize(string,string)"](name, symbol).then( ... );

// initialize(string _name, string _symbol, address _registry);
contract["initialize(string,string,address)"](name, symbol, address).then( ... );

// initialize(string _sender);
contract["initialize(string)"](sender).then( ... );

// initialize();
contract["initialize()"]().then( ... );

Specifying the function works for me.

More info: https://github.com/ethers-io/ethers.js/issues/407#issuecomment-458329708

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.