Can't connect truffle console to infura rinkeby, but truffle migrate works?

I’m using truffle 5.1.17 and @truffle/hdwallet-provider 1.0.33. I’m able to successfully migrate to rinkeby by doing:

truffle migrate --network rinkeby

Then, when I try to do

truffle console --network rinkeby

it fails with this error:

truffle(rinkeby)> Error: CONNECTION ERROR: Couldn’t connect to node
at Object.InvalidConnection (
at HttpProvider.send (
at ProviderSubprovider.handleRequest (
at next (
at FilterSubprovider.handleRequest (
at next (
at NonceTrackerSubprovider.handleRequest (
at next (
at HookedWalletSubprovider.handleRequest (
at next (
at Web3ProviderEngine._handleAsync (
at EthQuery.sendAsync (
at EthQuery.getBlockByNumber (
at \node_modules\pify\index.js:29:7
at new Promise ()
at EthQuery. (
at EthQuery.ret (
at RpcBlockTracker._fetchBlockByNumber (
at RpcBlockTracker._performSync (
at RpcBlockTracker.start (
at processTicksAndRejections (internal/process/task_queues.js:97:5)

My truffle config for rinkeby is:

rinkeby: {
  provider: function() {
    return new HDWalletProvider(mnemonic, "***************");
  network_id: '4',

Very strange that the migrate works but console fails, with the same configuration? Any ideas? I verified I’m also able to get a response from a curl request to my infura endpoint.

Infura doesn’t support the Javascript attach and console functionality of Geth, for example. I’m not entirely sure what truffle console depends on to work.

Can you try the same command with --verbose-rpc flag and see if there is any additional detail? Meanwhile, we’ve reached out to the Truffle team for input.

Thanks for the help. I tried adding the --verbose-rpc and it didn’t produce anything extra. I think the issue may have to do with something in the provable-eth-api package I’m using. After compilation and migration, if I delete the Buffer.json compiled library (part of provable), then I can actually connect with truffle console just fine, and interact with the deployed contract. I’ve reached out to the provable support on this, too.

Great to hear you have narrowed it down and thanks for contributing to our community your findings. I’ll add here if I hear anything from Truffle support.

1 Like