Get an error when using Web3 1.0 batch requests with truffle contract calls:
TypeError: Cannot set property 'requestManager' of null
at Batch (./node_modules/web3-core-requestmanager/src/batch.js:29:25)
at module.exports (./migrations/migrate_to_latest.js:50:26)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7
I've Googled around a bit for this, but I can't really see any attempts of people trying to use batch requests with truffle, or whether it's intended to be supported.
Create a web3 BatchRequest and add a truffle call to it:
let batch = web3.BatchRequest();
batch.add(newPoolOwners.setContribution(
ownersObj.owners[i].address,
ownersObj.owners[i].tokenAmount
));
Batch request is built with multiple transactions and executes fine.
Error above is given.
truffle version):Truffle v4.1.14 (core: 4.1.14)
Solidity v0.4.24 (solc-js)
node --version): v8.9.3npm --version): 6.4.1@jleeh Web3.js 1.0 is only supported in Truffle v5 beta or higher. Please try out the beta by running the following commands:
npm uninstall -g truffle
npm install -g truffle@beta
And let me know if that works for you. Thanks!
I tried with Truffle v5 and got the same error I mentioned in the original issue. I'm going to close this issue as I think it's deps problem rather than an actual one, then I just ran single TX's rather than batching. Thanks for the help though @gnidan
@jleeh Were you able to solve this issue?