I'm trying to deploy a contract on Avalanche Fuji testnet using Truffle. Here is my truffle config:
require('dotenv').config();
const mnemonic = process.env["MNEMONIC"];
const infuraUrl = process.env["INFURA_URL"]; //https://avalanche-fuji.infura.io/v3/...
const HDWalletProvider = require('@truffle/hdwallet-provider');
module.exports = {
networks: {
development: {
host: "127.0.0.1",
port: 8545,
network_id: "*"
},
fuji: {
provider: () => new HDWalletProvider(mnemonic, infuraUrl),
network_id: "43113",
gas: 5000000,
networkCheckTimeout: 1000000,
timeoutBlocks: 200,
}
},
...
}
};
When I run truffle migrate --network fuji, I get the following error:
Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.
/Users/me/Projects/myProject/node_modules/eth-block-tracker/src/polling.js:51
const newErr = new Error(`PollingBlockTracker - encountered an error while attempting to update latest block:\n${err.stack}`)
^
Error: PollingBlockTracker - encountered an error while attempting to update latest block:
undefined
at PollingBlockTracker._performSync (/Users/me/Projects/myProject/node_modules/eth-block-tracker/src/polling.js:51:24)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at runNextTicks (node:internal/process/task_queues:64:3)
at listOnTimeout (node:internal/timers:540:9)
at processTimers (node:internal/timers:514:7)
UnhandledRejections detected
Promise {
<rejected> {
code: -32603,
message: 'Socket connection timeout',
data: { originalError: [Object] }
}
} {
code: -32603,
message: 'Socket connection timeout',
data: { originalError: { code: 'ERR_SOCKET_CONNECTION_TIMEOUT' } }
}
...
Some people mentioned its the internet speed but the internet speed at my place is very fast. Does anyone know what the issue is? Is it the Infuria API?
There might be many reasons
your
infuraUrlis eitherundefinedor you did not paste the correct url.it might be dns issue. try to change the dns provider
your infura node might go down. Infura sometimes suffers from outage