Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

web3.currentProvider.sendAsync is undefined #1119

Closed
lightninglu10 opened this issue Oct 16, 2017 · 13 comments
Closed

web3.currentProvider.sendAsync is undefined #1119

lightninglu10 opened this issue Oct 16, 2017 · 13 comments
Assignees
Labels

Comments

@lightninglu10
Copy link

Hey guys, getting a weird bug here.

I'm setting up my web3 like this

var web3 = new Web3(new Web3.providers.HttpProvider(BLOCKCHAIN_ADDR));

But I'm getting an error with web3.currentProvider.sendAsync is undefined, but web3.currentProvider.send is defined. Anyone know what's up?

@dkchv
Copy link

dkchv commented Oct 17, 2017

try to add before create new instance:
Web3.providers.HttpProvider.prototype.sendAsync = Web3.providers.HttpProvider.prototype.send

@frozeman
Copy link
Contributor

@dkchv thanks, could you tell me where you get this? which version of web3.js?

@dkchv
Copy link

dkchv commented Oct 20, 2017

I tried to use web3 v1, but out app also use truffle-contract, which use web3 0.20. So then I setProvider to web3 v1, I also set this provider to truffle-contract. And finally truflle-contract tried to invoke sendAsync throw web3 0.20 interface.
Line above fix this difference for httpProvider bettween v1 and v0.20.

@pfrank8
Copy link

pfrank8 commented Feb 2, 2018

Hey folks, another potential fix for this could be to make sure you import Web3 before you import any artifacts -- even if you define networks later.

@Alexintosh
Copy link

I have the same issue, strangely, this happen only on specific iphone models.
The workaround doesn't seem to work.

"web3": "^0.20.6",
"web3-provider-engine": "13.6.0"

@Alexintosh
Copy link

This issue should probably be reopened

@devzl
Copy link

devzl commented Jun 4, 2018

web3.providers.HttpProvider.prototype.sendAsync = web3.providers.HttpProvider.prototype.send; fixes it for me, I think it's because truffle-contract uses the 0.2x version of web3 while I'm using the v1.0.0

@Alexintosh
Copy link

@devzl it doesn't work client side with Infura nodes. Particularly with American iPhones.

@Alexintosh
Copy link

Following my previous comment. I couldn't find any way to solve this client side, so I ended up only signing the transaction in the mobile client and broadcasting it server side. If you are interested in a microservice to do that you can find the Tx-broadcaster Repository by DEXlab.io here.

@nivida nivida self-assigned this Aug 9, 2018
@nivida nivida closed this as completed Aug 9, 2018
@Alexintosh
Copy link

Not sure why this has been closed ¯_(ツ)_/¯

@nivida
Copy link
Contributor

nivida commented Aug 9, 2018

Oops sorry.. 🙈

@nivida nivida reopened this Aug 9, 2018
aJoohongKim pushed a commit to starpay/drizzle that referenced this issue Sep 15, 2018
drizzle does not supporting http. Maybe some issues? We will see during the project. This time we'd like to get to MVP fast by adding HttpProvider init.
sendAsync error 
web3/web3.js#1119
ProphetDaniel pushed a commit to ProphetDaniel/truffle-safe-hdwallet-provider that referenced this issue Sep 24, 2018
Prettified, worked around this bug web3/web3.js#1119, var to const whenever possible.
@jsliu27
Copy link

jsliu27 commented Nov 23, 2018

Hey guys, getting a weird bug here.

I'm setting up my web3 like this

var web3 = new Web3(new Web3.providers.HttpProvider(BLOCKCHAIN_ADDR));

But I'm getting an error with web3.currentProvider.sendAsync is undefined, but web3.currentProvider.send is defined. Anyone know what's up?

您好,我想知道如何创建自己的web3,来实现链上支付,如果您知道,还请您多多帮助一下

@nivida
Copy link
Contributor

nivida commented Mar 25, 2019

Version 0.20.x got his last maintenance release with v0.20.7. Please update your code to the latest 1.0 version of Web3.js. Further details about the current project state are explained in the release announcement of version 1.0.0-beta.38.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants