I'm trying to run truffle develop, but about 95% of the time I get the following timeout error:
Error: There was a timeout while attempting to connect
to the network.
Check to see that your provider is valid.
If you have a slow internet connection, try configuring a longer timeout in your Truffle config. Use the networks[networkName].networkCheckTimeout property to do this.
So I've added networkCheckTimeout: 10000000 to my develop network in truffle-config, as the error appears to suggest, but it hasn't solved the problem.
Run truffle develop - possibly only on slow wifi networks.
truffle develop runs as usual without error.
Error: There was a timeout while attempting to connect
to the network.
Check to see that your provider is valid.
If you have a slow internet connection, try configuring a longer timeout in your Truffle config. Use the networks[networkName].networkCheckTimeout property to do this.
truffle version): v5.0.43node --version): v10.16.3npm --version): v6.9.0Hey @KadenZipfel ! If you are using GanacheUI, I would recommend connecting using truffle console instead of truffle develop.
What network are you connecting to? Are you using ganache?
What network are you connecting to? Are you using ganache?
I'm using ganache with port 8545
Does it work if you connect using truffle console? You can also specify the network configuration you are using with the --network flag if you need to like truffle console --network develop.
Does it work if you connect using
truffle console? You can also specify the network configuration you are using with the--networkflag if you need to liketruffle console --network develop.
Still returns the same timeout error
networkCheckTimeout does work with truffle console at least, but it will just hang and never connect
What does your Truffle config look like? It looks like it is having trouble connecting to your network for some reason. Under the hood it is just trying to get the latest block number (using web3.eth.getBlockNumber()) to make sure it gets a valid response. I cannot duplicate your error here locally.
const path = require("path");
module.exports = {
contracts_build_directory: path.join(__dirname, "client/src/contracts"),
networks: {
develop: {
host: "127.0.0.1",
port: 8545,
network_id: "1001"
}
}
};
What happens if you set your network_id to "*"?
Error: The network id specified in the truffle config (5777) does not match the one
returned by the network (1001). Ensure that both the network and the provider are properly configured.
This kind of sounds like there might be several chains running on your computer and messing up things. Make sure all of your other instances of Ganache and whatnot are terminated and see if your problem persists. To make sure you might restart your computer as well. Let me know how it goes!
Initially it seemed the issue was still there after restart, but now it seems to be working fine... We'll see how it works going forward.
Super! I'm going to close this for now, if the problem ends up persisting then I'll be happy to re-open it.
I had exact problem with deploying to reinkeby using Infura. Simply timeouts.
I have used this command to test response coming back from Infura and it works.
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":83}' https://rinkeby.infura.io/v3/[ my key]
I got this response.
{"jsonrpc":"2.0","id":83,"result":"0x52c10d"}
I'm having similar issues in my project https://github.com/DataHighway-com/mining
I'm using Truffle v5.1.10.
If I run a separate "development" chain on port 8545 with ganache-cli by following my steps here so I can specify custom CLI options such as where the chain database is stored, then when I run truffle migrate --reset --network development or even just truffle migrate --reset, it successfully compiles all my contracts, but it always times out before deploying any of the contracts (even after configuring a large value for networkCheckTimeout).
But I do not understand why it doesn't work anymore when using Truffle v5.1.10.
Note that in the past doing this actually worked (when I used this approach in one of my older repos here), but back then I was using an older version of Truffle (i.e. i think i was using v3 or v4 at the time).
To reproduce run the following two steps:
1) Start Ganache CLI in Terminal Tab 1
nvm use v11.6.0
npm install -g truffle ganache-cli
ganache-cli \
--account="0x0000000000000000000000000000000000000000000000000000000000000001, 2471238800000000000" \
--account="0x0000000000000000000000000000000000000000000000000000000000000002, 4471238800000000000" \
--unlock "0x0000000000000000000000000000000000000000000000000000000000000001" \
--unlock "0x0000000000000000000000000000000000000000000000000000000000000002" \
--blockTime 0 \
--port 8545 \
--hostname localhost \
--seed 'blah' \
--debug true \
--mem true \
--mnemonic 'something' \
--db './db/chain_database' \
--verbose \
--networkId=3 \
--gasLimit=7984452 \
--gasPrice=20000000000;
2) Run the following in Terminal Tab 2
https://github.com/DataHighway-com/mining/commit/68e41025320c6dacd37826b8bc30d9f63d9f5708
git clone https://github.com/DataHighway-com/mining
git checkout e442f37a10291a7d93fd9c5068b4e10f554738ed
cd ./mining/tokens/mxc
nvm use v11.6.0
npm install
truffle migrate --reset --network development
Also, if in my project I instead run truffle develop, which itself starts a development chain but on port 9545, and then truffle(develop)> migrate --reset --network development to migrate using the development chain that i'm running on port 8545 instead, I have the same issue of it timing out and not deploying the contracts.
But if I don't try to run it using the "development" chain that I already started by with ganache-cli on port 8545, and I instead just run by running truffle develop and then truffle(develop)> migrate --reset, then it says it migrated the contracts on the 'develop' network that has network_id of say 5777.
Questions:
truffle develop on port 9545. I also get the timeout when trying to run my tests with truffle testtruffle develop like I can do with ganache-cli (i.e. specify custom folder for the chain database)?truffle develop when using Truffle 5?@KadenZipfel Please see my comment. Would you agree this issue should be re-opened?
After trying alternatives, I've revisited the timeout issue and it's no longer occurring. Unfortunately I have no idea why (perhaps because I ran npm uninstall ganache-cli -g &&
npm install ganache-cli@beta -g this time instead of just npm install -g ganache-cli...). I've restarted numerous times since I first raised my issue ~2 months ago.
@win2win , I got the same error. How do you fix it? thanks.
@win2win @KimiWu123 Make sure you're using your Infura project ID and not project secret.
@caseykey , It worked well in the beginning and suddenly I got the timeout error. I didn't change any configs only tried to deploy and test my contract. I used curl to test Infura server, it's okay. After 2, 3 hours later, it works again.
Got the same issue while trying to run truffle migrate --network ropsten --reset inside of ~/MyProject/contracts
I just go back to the main project directory ~/MyProject and then run truffle migrate --network ropsten --reset and fixed.
@win2win @KimiWu123 I got the same error too.
@KimiWu123 have u fixed it?
@sxguan , it just worked after couples of hours. I didn't do anything...
I restarted the server and it worked for me.
me too
clear local DNS cache,it worked for me.
place the
networkCheckTimeout: 10000 before the provider and it worked.
Hi, I'm having the same problem. I've already asked at Truffle Gitter and at Infura's community forum, but nothing.
My problem is very much related... it takes 20 minutes to get connection via Infura to Ropsten. I can either open a Truffle console or deploy, but it takes at least 20 minutes best case scenario. Worst case I just get the timeout/network issue messages the mentioned above.
Environment is:
And below my truffle-config.js for Ropsten:
const HDWalletProvider = require("@truffle/hdwallet-provider");
...
ropsten: {
// networkCheckTimeout: 100000, // NB: this option does nothing
provider: () =>
new HDWalletProvider(
process.env.MNEMONIC_2,
process.env.ROPSTEN_HTTPS_ENDPOINT
),
network_id: 3,
gas: 5500000,
skipDryRun: true,
},
Any help will be very welcomed.
P.S.: ok, my mind is totally blown... I'm carrying lots of tests trying to guess what is going on and just now I've switched the internet from my WiFi/Ethernet to my phone 4g (tethering) and I got instant connection. I literally do not understand what is going on.
Ok, I can confirm it is my ISP (either via Ethernet or WiFi), Hyperoptic Fibre from UK.
I had this issue for a few days before realizing it was a syntax error, hope it helps
I had this too and turn out to be using a deprecated infura key.
Most helpful comment
I had this issue for a few days before realizing it was a syntax error, hope it helps