Truffle: "websockets: true" error messages lacking detail compared to http rpc

Created on 12 Jan 2019  路  5Comments  路  Source: trufflesuite/truffle

Issue

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

Steps to Reproduce

  1. Configure truffle to use ganache with websockets.
  2. Run truffle migrate with ganache NOT running.

Solution

Catch this error and give the pretty error message.

error better help wanted

All 5 comments

@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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maximilianh picture maximilianh  路  3Comments

bmmpxf picture bmmpxf  路  3Comments

ferittuncer picture ferittuncer  路  3Comments

arunmitteam picture arunmitteam  路  3Comments

rjl493456442 picture rjl493456442  路  4Comments