I was trying to deploy some contracts on Rinkeby using Infura, and got the following error:

Error: certificate has expired\n    at TLSSocket.onConnectSecure (_tls_wrap.js:1088:34)\n    at TLSSocket.emit (events.js:198:13)\n    at TLSSocket._finishInit (_tls_wrap.js:666:8)' }

(The complete stack trace is at the bottom of the question.)

I'm using a deploy script as so:

if (network == 'rinkeby') {
        // Overriding default config for rinkeby test net
        defaultConfigs.chainId = 4;
        // Setting private key for this network
        secret = process.env.DEPLOYER_PRIVATE_KEY_RINKEBY;
        // Setting the RPC
        RPC = `https:/rinkeby.infura.io/v3/${process.env.INFURA_API_KEY_RINKEBY}`;

        console.log("Deploying to Rinkeby network");

This script is using Etherlime's tools (elsewhere in the script, I'm not bringing it all since it seems to work, as you'll see in a minute that I could deploy on local RPC using it), and as you can assume dotenv for the environmental variables, which as far as I can tell, are set properly.

In the end I ended up spinning up a local Rinkeby node and deployed using the same script from local - I just changed the RPC variable to hit localhost, and that worked fine. (So no problems with the Etherlime, as far as I can tell.)

What is going wrong here?


Here's the whole stack trace, with some details (like the actual Infura API key) edited out:

➜ yarn deploy:rinkeby
yarn run v1.22.5
$ etherlime deploy --network=rinkeby --runs=500
Compilation finished successfully
Deploying to Rinkeby network
Deployer set to deploy from address: 0x...

JSONRPC Deployer Network: https:/rinkeby.infura.io/v3/...

Deploying contract: Library_Token
{ Error: invalid response - 0
    at exports.XMLHttpRequest.request.onreadystatechange (/home/x/code/project/Blockchain/node_modules/etherlime-lib/node_modules/ethers/utils/web.js:84:29)
    at exports.XMLHttpRequest.dispatchEvent (/home/x/code/project/Blockchain/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:591:25)
    at setState (/home/x/code/project/Blockchain/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:610:14)
    at exports.XMLHttpRequest.handleError (/home/x/code/project/Blockchain/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:532:5)
    at ClientRequest.errorHandler (/home/x/code/project/Blockchain/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:459:14)
    at ClientRequest.emit (events.js:198:13)
    at TLSSocket.socketErrorListener (_http_client.js:401:9)
    at TLSSocket.emit (events.js:198:13)
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
  statusCode: 0,
   'Error: certificate has expired\n    at TLSSocket.onConnectSecure (_tls_wrap.js:1088:34)\n    at TLSSocket.emit (events.js:198:13)\n    at TLSSocket._finishInit (_tls_wrap.js:666:8)' }
Your deployment script finished with failure!

Here is your report:

Done in 32.09s.

Thanks for reading, and super thanks if you took the time to write an answer!

1 Answer 1


The issue is that you are missing a / in your URL. The following line should have https:// and not https:/.

RPC = 'https:/rinkeby.infura.io/v3/${process.env.INFURA_API_KEY_RINKEBY}';

  • I can't believe I missed that - I feel like a idiot. Thanks for answering a typo kindly. Oct 25, 2020 at 7:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.