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 https://rinkeby.infura.io/v3/.
at Object.InvalidConnection (
\node_modules\web3-core-helpers\src\errors.js:35:16)
at HttpProvider.send (
\node_modules\web3-providers-http\src\index.js:109:25)
at ProviderSubprovider.handleRequest (
\node_modules\web3-provider-engine\subproviders\provider.js:16:17)
at next (
\node_modules\web3-provider-engine\index.js:119:18)
at FilterSubprovider.handleRequest (
\node_modules\web3-provider-engine\subproviders\filters.js:89:7)
at next (
\node_modules\web3-provider-engine\index.js:119:18)
at NonceTrackerSubprovider.handleRequest (
\node_modules\web3-provider-engine\subproviders\nonce-tracker.js:79:7)
at next (
\node_modules\web3-provider-engine\index.js:119:18)
at HookedWalletSubprovider.handleRequest (
\node_modules\web3-provider-engine\subproviders\hooked-wallet.js:234:7)
at next (
\node_modules\web3-provider-engine\index.js:119:18)
at Web3ProviderEngine._handleAsync (
\node_modules\web3-provider-engine\index.js:106:3)
at EthQuery.sendAsync (
\node_modules\eth-query\index.js:66:24)
at EthQuery.getBlockByNumber (
\node_modules\eth-query\index.js:80:10)
at \node_modules\pify\index.js:29:7
at new Promise ()
at EthQuery. (
\node_modules\pify\index.js:12:10)
at EthQuery.ret (
\node_modules\pify\index.js:56:34)
at RpcBlockTracker._fetchBlockByNumber (
\node_modules\eth-block-tracker\src\index.js:200:47)
at RpcBlockTracker._performSync (
\node_modules\eth-block-tracker\src\index.js:120:35)
at RpcBlockTracker.start (
******\node_modules\eth-block-tracker\src\index.js:62:12)
at processTicksAndRejections (internal/process/task_queues.js:97:5)

My truffle config for rinkeby is:

rinkeby: {
  provider: function() {
    return new HDWalletProvider(mnemonic, "https://rinkeby.infura.io/v3/***************");
  },
  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