Skip to main content
2 of 2
added 132 characters in body
Badr Bellaj
  • 18.8k
  • 4
  • 59
  • 75

Getting the error :- Web3ProviderEngine does not support synchronous requests

Below is my migration file,

var startTime = web3.eth.getBlock(web3.eth.blockNumber((err, res) => {})).timestamp + 30;
var endTime = startTime + 4 * 60 * 60;
var presaleLimit = startTime + 1 * 60 * 60;
var crowd1Limit = startTime + 1.45 * 60 * 60;
var crowd2Limit = startTime + 2.30 * 60 * 60;
var crowd3Limit = startTime + 3.15 * 60 * 60;
var disc1 = web3.toWei('1', 'ether');
var disc2 = web3.toWei('2', 'ether');
var rate = 3;
var wallet = '0x58B219a8Fd3897303D3C106031736df26Ad3A406';
module.exports = function(deployer) {
  deployer.deploy(SetherCrowdsale, startTime, endTime, rate, wallet, presaleLimit, crowd1Limit, crowd2Limit, crowd3Limit, disc1, disc2);
};

I am getting the below error while trying to run this on ropsten.

Running migration: 2_deploy_contracts.js

/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-error/index.js:10
  this.stack = (new Error(message)).stack;
^
/usr/local/lib/node_modules/truffle/build/cli.bundled.js:219413
        throw error;
        ^

Error: Web3ProviderEngine does not support synchronous requests.
    at ProviderError.ExtendableError (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-error/index.js:10:1)
    at new ProviderError (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-provider/error.js:17:1)
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-provider/wrapper.js:71:1
    at HDWalletProvider.send (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-provider/wrapper.js:109:1)
    at Object.send (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-migrate/index.js:209:1)
    at RequestManager.send (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/requestmanager.js:58:1)
    at Eth.get [as blockNumber] (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/property.js:107:1)
    at /home/fkp/Desktop/BCW/migrations/2_deploy_contracts.js:3:44
    at Script.runInContext (vm.js:74:29)
    at Script.runInNewContext (vm.js:80:15)
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-require/require.js:97:1
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:532:3)