6

I am facing this error when on running truffle migrate on Rinkeby network with my infura

enter image description here

3 Answers 3

4

I found the fix by changing the infura Rinkeby RPC_URL in 'the truffle-config.js' file.

Originally I was using the https://rinkeby_url. On using wss://rinkeby_url - it got fixed. Please see a snapshot of the URL from infura. You can create a account on infura and generate these URL. Example of URL from Infura

Example of my truffle-config.js

    rinkeby: {
      provider: () => {
        return new HDWalletProvider(process.env.MNEMONIC, process.env.RINKEBY_RPC_URL)
      },
      network_id: "4",
      networkCheckTimeout: 1000000,
      timeoutBlocks: 200,
      addressIndex: 2

    },
5
  • 3
    Please fix the typo and provide the url you actually used, not the env var where you stored it... Aug 29, 2021 at 20:02
  • need url not the env variable Aug 31, 2021 at 5:58
  • @DeepakBhavsar I have fixed one typo. And sorry I cannot display the complete URL, although I have added a cut snapshot for the same. You can easily generate your RPC URL from Infura. Sep 6, 2021 at 6:55
  • That just saved my life.. Thank you so much. @sahilkharya How did you find this solution?
    – AlonBA
    Mar 15 at 16:27
  • @AlonBA - You are welcome. I was facing the issue and just tried different approaches, changing values and was able to fix it. Mar 24 at 2:12
1

I met the same problem. Here is how I resolved this problem:

I saw this error message, just saying "this operation is timeout", don't just focus on this error, you should also check the browser with the transaction id.

e.g.

Step1. I ran this command to deploy:

truffle deploy --network goerli --verbose-rpc --interactive --skip-dry-run --reset

and it may give this error :

Error: PollingBlockTracker - encountered an error while attempting to update latest block:
undefined
    at PollingBlockTracker._performSync (/mnt/d/workspace/test_truffle/node_modules/eth-block-tracker/src/polling.js:51:24)

so, let increase the timeout config:

// truffle-config.js 
require('dotenv').config();
const HDWalletProvider = require('@truffle/hdwallet-provider');
const { INFURA_API_URL, MNEMONIC } = process.env;

module.exports = {
  networks: {
    development: {
      host: "127.0.0.1",
      port: 8545,
      network_id: "*"
    },
    goerli: {
      provider: () => new HDWalletProvider(MNEMONIC, INFURA_API_URL),
      network_id: '5',
      gas: 5500000,

      // you can also increase the gas price from default to 50 gwei, which is very high in 2022.6
      gasPrice: 50000000000,

      //  This is the timeout config. set it to 1000 seconds
      networkCheckTimeout: 1000000,    
      timeoutBlocks: 200,
      addressIndex: 2
    }
  }
};

step2. run the command again, and you would get an output looks like:

enter image description here

copy this tx and view it on goerli.etherscan.io: you may found it's pending

enter image description here

step3. let's increase the gas price from default to 50Gwei, then resend this rpc call:

// truffle-config.js

    goerli: {
      // ....
      // you can also increase the gas price from default to 50 gwei, which is very high in 2022.6
      gasPrice: 50000000000,

    }

then re-execute the command:

truffle deploy --network goerli --verbose-rpc --interactive --skip-dry-run --reset

then everything looks fine:

enter image description here

step4. finally , I checked the blockchain browser when I met "752 seconds timeout", I found at that time, all people's tx is pending ( another word, there's no one successful block minted during 40 minutes) . see the image below:

enter image description here

0

You can also use compile-none when deploying. If your migration file has a lot of contracts to compile, truffle sends requests to get latest block. If provider limits the number of calls you can do it, it will timeout. Use compile-none and it will work fine.

More details here: BSC Testnet: Truffle Migrate ETIMEDOUT

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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