I forgot to start ganache before running my tests. When I was using the http rpc (the default), I got this very helpful error message.
Could not connect to your Ethereum client. Please check that your Ethereum client:
- is running
- is accepting RPC connections (i.e., "--rpc" option is used in geth)
- is accessible over the network
- is properly configured in your Truffle configuration file (truffle.js)
The error with websockets: true in the networks block of truffle-config.js is much less helpful:
connection not open on send()
connection not open
truffle migrate with ganache NOT running.Catch this error and give the pretty error message.
@WyseNynja Could I take a look at your truffle config?
Sure.
module.exports = {
compilers: {
solc: {
version: "0.5.2",
optimizer: {
enabled: true,
},
},
mocha: {
reporter: 'eth-gas-reporter',
reporterOptions : {
currency: 'USD',
gasPrice: 20,
},
},
networks: {
development: {
host: "host.docker.internal",
port: 7545,
network_id: "5777",
websockets: true,
},
coverage: {
host: "127.0.0.1",
network_id: "*",
port: 8555, // <-- If you change this, also set the port option in .solcover.js.
gas: 0xfffffffffff, // <-- Use this high gas value
gasPrice: 0x01, // <-- Use this low gas price
},
},
};
I'm running ganche on my mac (so i get the awesome UI) and truffle inside a docker container. host.docker.internal is essentially localhost. Everything works fine if ganache is running. My problem is just that the error message isn't as helpful when websockets are enabled.
Oh I see, this is not a problem you need to resolve but rather a request for prettier output. Always nice...thanks!
Err, I mean "more helpful" output.
I believe this is solved in the most recent versions of Truffle. Closing for issue maintenance, but please let us know if it is still an issue and we will reopen. Thanks for bringing this to our attention!