Calling web3.currentProvider.sendAsync raise an exception:

Uncaught TypeError: web3.currentProvider.sendAsync is not a function

Note: I faced this error when using https://www.npmjs.com/package/@digix/tempo. However, sendAsync is not a function inside web3.currentProvider when trying to check this with Web3 v1.0


Actually web3.currentProvider.sendAsync is depricated in Web3 v1.0 and it is replaced with web3.currentProvider.send.

So simply replace web3.currentProvider.sendAsync with web3.currentProvider.send when using Web3 v1.0.

For my case, I forked the "DigixGlobal tempo" repository from https://github.com/DigixGlobal/tempo, modified the code and made a pull request.


Anyone who arrived here from having a solidity-coverage error when running truffle coverage and having it fail verus truffle test and having that succeed, the answer is correct, change .sendAsync to .send. It takes longer to run, but works.

It seems like the injected web3 instance during the coverage plugin is slightly different to the web3 instance during truffle test.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.