Reputation: 432
I'm getting a timeout error when I try to send the contract to Ganache. My code is as follows,
const assert = require('assert');
const ganache = require('ganache-cli');
const Web3 = require('web3');
const web3 = new Web3(ganache.provider());
const {interface,bytecode} = require('../compile');
let accounts;
let inbox;
beforeEach(async() => {
accounts = await web3.eth.getAccounts();
inbox = await new web3.eth.Contract(JSON.parse(interface))
.deploy({data: bytecode,arguments:['Hi There !'] })
.send({from: accounts[0], gas:'1000000'});
});
describe("inbox", () => {
it('deploys a contract', () => {
console.log(inbox);
})
})
When I comment out the send method (provided below), the program runs without any issues. However, adding it back introduces the timeout error. No matter howmuch time I assign for mocha timeout, I still get the same error.
.send({from: accounts[0], gas:'1000000'});
There are similar posts regarding timeout such as listed below, Error: Timeout of 2000ms exceeded. For async tests and hooks. Unit test with mocha and chai
Unit test error with mocha and chai Timeout of 2000ms exceeded. For async tests and hooks
Mocha testing with promises: Error: Timeout of 2000ms exceeded
Mocha exceeding 2000ms timeout when returning a promise
None of the above solutions worked for me (mostly talking about increasing the timeout). Additionally, I downgraded web3 library as proposed in a different forum. However, it didn't work either.
You can find the exact issue posted by someone else at a different forum. Apparently, that question has not received any potential answers as well.
Upvotes: 3
Views: 1171
Reputation: 432
I installed truffle v5.0.24 and started working on the truffle console which solved all the issues.
Upvotes: 0