Client network socket disconnected before secure TLS connection was established

I get the following error when executing truffle migrate --network rinkeby --compile-all:

Error: Client network socket disconnected before secure TLS connection was established
    at connResetException (internal/errors.js:639:14)
    at TLSSocket.onConnectEnd (_tls_wrap.js:1570:19)
    at TLSSocket.emit (events.js:412:35)
    at endReadableNT (internal/streams/readable.js:1334:12)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)

My truffle-config.js contains:

rinkeby: {
  networkCheckTimeout: 1000000,
  provider: () => new HDWalletProvider(mnemonic, `wss://speedy-nodes-nyc.moralis.io/${moralisId}/eth/rinkeby/ws`),
  websockets: true,
  network_id: 4,
  gasPrice: 10e9,
  gas: 10e6,
  skipDryRun: true
}

moralisId is of course the unique ID to resolve my full Speedy Nodes URL.

This error happened after changing the HDWalletProvider URL from wss://rinkeby.infura.io/ws/v3/${infuraProjectId} which is of course Infura and worked absolutely fine.

However, if I compile the contracts first, and use --compile-none instead of --compile-all, itโ€™s fine, but this bloats my pipeline. Iโ€™ve tried adding networkCheckTimeout: 1000000 to the config (as suggested elsewhere, and can be seen above), but to no avail.

What am I missing?

1 Like

It looks like it could not even connect from that error. You could try to see if that RPC url works for a simple request to get last block number for example. Also to check if the url is not blocked somehow like by a firewall/vpn.

But if I compile the contracts first using truffle compile --all, then use --compile-none instead of --compile-all in the call to truffle migrate, itโ€™s fine. So, the URL mustnโ€™t be blocked.

Ok, strange, did you try updating truffle?

Yes, updated everything to latest.

I too have the same problem

you could try with different node providers maybe to see if it works

I have tried with polygon mumbai testnet.