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.version.getNetwork() stops working after changing network with metamask #1166

Closed
chafey opened this issue Mar 4, 2017 · 6 comments
Closed
Assignees

Comments

@chafey
Copy link

chafey commented Mar 4, 2017

Observed: web3.eth.getNetwork() never invokes callback after changing network via metamask
Expected: web3.eth.getNetwork() should not silently fail. It should work properly, return error, throw exception or possibly reload the web page if needed when the network is changed via metmask.

Steps to reproduce:

  1. Start chrome, create a new tab, open developer tools
  2. in console type:
    web3.version.getNetwork(function(err,res) {console.log(err,res);});
    observe the console output of undefined, "1" (for mainnet) is printed
  3. Use metmask to change to testnet
  4. in console type:
    web3.version.getNetwork(function(err,res) {console.log(err,res);});
    observe that nothing is printed to console, no error is returned and no exception is thrown
@chafey
Copy link
Author

chafey commented Mar 4, 2017

#873 related?

@danfinlay
Copy link
Contributor

I think related to #1148

@danfinlay danfinlay added the ready label Mar 6, 2017
@danfinlay danfinlay added this to the Core Maintenance milestone Mar 6, 2017
@kumavis kumavis modified the milestones: Core Maintenance, Publish 3.4.x Mar 6, 2017
@danfinlay
Copy link
Contributor

More related to #873. You want a way to detect manual network changes.

@kumavis
Copy link
Member

kumavis commented Mar 6, 2017

This is actually bc metamask disconnects from the dapp when changing networks and we are not forcing the dapp to reload.

@kumavis
Copy link
Member

kumavis commented Mar 6, 2017

duplicate of #873

@kumavis kumavis closed this as completed Mar 6, 2017
@ghost ghost removed the ready label Mar 6, 2017
@Fthi-S3074641
Copy link

I had web3 1.0.0 beta and that was causing an error.
Installing version 0.19.0 like this fix the issue:

npm install --save web3@^0.19.0

And it worked for me.

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

No branches or pull requests

4 participants