-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Promise web3.eth.getAccounts() not working with 1.0.0-beta.46 #2412
Comments
seem last version runnable with above code is 1.0.0-beta.37 |
Could you please update your issue to be aligned with the issue template? |
done, updated.... thank you |
BTW, both |
@dexterchan Thanks for updating the issue. This happens because of the ganache-provider and will be fixed in the next version. (PR: #2426) |
Am trying to use the same function with truffle and infura beta-36 and beta-37: Nothing after the getAccounts() statement gets executed, blank screen. beta-26: core.addProviders is not a function Here is the code:
Please help..... |
@aks30498 What's your version of truffle-hdwallet-provider?
and it works |
@chaitanyapotti I have truffle 0.0.3 .... Anyways.... I removed "v3" from Infura link.... And it worked... :) |
This is still unresolved for me. |
Yes @GNSPS it doesn't work with Infura, web3@1.0.0-beta.47 and truffle-hdwallet-provider@1.0.5
The error message can be logged by putting a try catch block. Downgrading web3 to 1.0.0-beta.37 however resolves the issue |
1.0.0-beta.37 still not working for me. 😞 Even inside a try catch block I get no output whatsoever. |
@GNSPS you need to remove v3 from infura link... I was stuck for 3 days as well... finally using beta.37 and truffle^0.0.3 and removing v3 from the link worked.... here's package:
and code:
|
This does indeed fix it! 😄 Thank you @aks30498! |
Still getting the same error even with @aks30498's step. and code is the following =>
Anything i could be missing? Thanks |
@AJSihota It shows some error or just nothing at all... and returns after some time ? When i faced issue in this part of course... it was related to gas and using 'gas': '3000000' fixed it. Also i think u should use accounts[0] to print the exact address intead of accounts which would print the array of all the addresses in first console log statement (although it wouldnt give any error but....just saying). |
@aks30498 This is my error message when I run the code above :
I've tried adjusting my gas amount and printing from first index of accounts instead of the entire array. But still getting this error message. I'm handling the callbacks with catch(e) but not sure if there could be something else I missed |
@AJSihota Exact same code worked for me when i deployed it!! i just redeployed it using my code to double check. And the error that it shows to you should be in the case when you called the getAccounts() method synchronously. Just make sure that async await is used correctly in your script. People have raised issue with this error earlier but using promises/async-await fixes it and we already have that in our code. Am also a newbie to solidity so i don't know what else can it be! I mean, the same code with same versions of dependencies works for me (just deployed a few seconds ago!) Ok... so to make sure there isn't any itty-bitty error that we're missing, i just copied the code given by you in your comment, entered my mnemonic and address, changed gas to 3000000 and it worked for me. I can't reproduce your issue. |
First I was using 1.0.0-beta.26...it was showing error as "core.addProviders is not a function"... |
TypeError: core.addProviders is not a function , |
I had the same issue described here. Code is exiting at below line without any error in console.
I was able to solve the problem when I run the deploy code after executing below command/.
|
This problem is because the dapps and metamask have stopped exposing user accounts by default on web page. |
I am using loopring SDK to get EcDSA Signature but getting the same error while passing web3 as follows:
Error:
|
web3 version 1.0.0-beta.46 is not able to fetch account with ganache
Expected behavior
await web3.eth.getAccounts() is able to output list of accounts
Actual behavior
the command failed with exception asking callback definition.
It does not happen in web3 1.0.0-beta.35, web3 1.0.0-beta.37
Steps to reproduce the behavior
Step 1: init ganache and web3 as below
"dependencies": {
"ganache-cli": "^6.3.0",
"web3": "^1.0.0-beta.46"
},
Step 2: run following codes:
const ganache = require('ganache-cli'); //access Eth test network
const Web3 = require('web3'); //Web3 "class"
const web3 = new Web3(ganache.provider());
accounts = await web3.eth.getAccounts(); <--- failed with exception
Error Logs
Error:
No callback provided to provider's send function. As of web3 1.0, provider.send is no longer synchronous and must be passed a callback as its final argument.
at b.send (node_modules/ganache-cli/build/ganache-core.node.cli.js:47:88610)
at GetAccountsMethod._callee$ (node_modules/web3-core-method/dist/web3-core-method.cjs.js:454:55)
at tryCatch (node_modules/regenerator-runtime/runtime.js:62:40)
at Generator.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:288:22)
at Generator.prototype.(anonymous function) [as next] (node_modules/regenerator-runtime/runtime.js:114:21)
at asyncGeneratorStep (node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
at _next (node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)
at node_modules/@babel/runtime/helpers/asyncToGenerator.js:32:7
at GetAccountsMethod. (node_modules/@babel/runtime/helpers/asyncToGenerator.js:21:12)
at GetAccountsMethod.execute (node_modules/web3-core-method/dist/web3-core-method.cjs.js:477:25)
at Proxy.anonymousFunction (node_modules/web3-core-method/dist/web3-core-method.cjs.js:228:25)
Versions
web3 1.0.0-beta.46
The text was updated successfully, but these errors were encountered: