MetaMask / metamask-extension

:globe_with_meridians: :electric_plug: The MetaMask browser extension enables browsing Ethereum blockchain enabled websites
https://metamask.io
Other
11.87k stars 4.85k forks source link

No evident UI to change network / login when perpetually "Connecting to Unknown Network" #5609

Closed wbt closed 5 years ago

wbt commented 5 years ago

Describe the bug When MetaMask can't connect to the last network it was connected to, it has an overlay that blocks UI functionality that would allow a user to gracefully recover from the situation.

To Reproduce Steps to reproduce the behavior:

  1. Install/log into MetaMask and connect to a custom network, for example local Ganache (http://127.0.0.1:7545).
  2. Do some transactions etc. to verify that everything is working fine as expected.
  3. Log out of MetaMask, maybe close the browser.
  4. Change to a state where that network you were connecting to is no longer accessible (e.g. close Ganache).
  5. Restart the browser. Click the MetaMask button to log in. You will see this: metamask forever connecting cannot change There is no clearly reachable UI to log in or to change networks.
    There are hidden workarounds, but no clear UI to make them easy to identify.
  6. If possible, remember which network you were last connected to (the network selector UI that could remind you of which one it is is gone, so you'll need to rely on a good memory) and the requirements for accessing it, and then return to a state where you can connect to the network you were last connected to (in this case, restart Ganache). Note: It is not always possible to meet the requirements for accessing that previous network, e.g. if the previous URL was on a server that's now down or on an access-limited network that you are no longer connected to.
  7. Again click the Metamask icon to attempt to log in.
  8. The results are the same as above; Metamask is stuck in this state without being able to determine that it can now connect.
  9. Close and restart the browser.
  10. Again click the Metamask icon to attempt to log in. This time, you'll see: metamask welcome back
  11. Log in and proceed.

SECRET UI WORKAROUNDS IN STEP 5: 5a: If you start typing the password immediately after the click to open the window, and use the Enter key after a correct password, it will log in. If you click in the password field first, intending to be sure the password field has input focus (generally a best practice for password entry), this will actually take focus away, because the overlay intercepted the click and took focus.

5b: If you click the spinner in the upper right, you do get the network select list, but like 5a that's not at all clear UI. However, clicking Custom RPC does nothing, other than dismiss the list. You have to click Main Ethereum Network and wait for a connection to get the overlay to disappear, then log in, and THEN click the network selector for the desired network.

If you are offline (e.g. on a plane or out somewhere without wifi), you won't be able to connect to the mainnet or any of the public testnets for workaround 5b. If you're intending to connect to localhost (or another address on a semi-isolated network you're now connected to), but that's not a previously created option in the network selector list, too bad. You won't be able to connect to any of the networks in the list and you can't access the Custom RPC UI to add it in. You have to go through the 5a workaround and be sure not to click.

Other routes to reproduce 12a. After logging in, open the network selector and choose one that you can't actually connect to at present (e.g. local Ganache, when Ganache is not running).
12b. Alternatively to 12a, after logging in, open the network selector and choose CustomRPC, then enter an RPC URL where there is no responsive Ethereum node, and click Save.

  1. You will see the "Connecting to Unknown Network" overlay forever as before, again with the network selector UI gone.
    Screenshot for route 12a: metamask connecting forever after login.
    Screenshot for route 12b: metamask connecting forever after login customrpc
    Assuming that users sometimes make errors when entering an RPC (e.g. choosing the wrong one of {http, https}, mistyping an IP or port number, using an incorrect separator, omitting the port number, etc., 12b is probably not that uncommon, and it should not leave the UI in an unusable state with no clear path to recovery.
  2. Closing the MetaMask popup and reopening it doesn't help.
  3. You can click the identicon circle in the upper right and Log Out, but then you're back at step 5 above.
  4. You can also close your browser and restart it, and then you're back at step 5 above.

Expected behavior A. There is no "Connecting to ... Network" overlay on the login page.
B. When the overlay is present (which per A should be only after login), the network selector is still visible and not replaced by a spinner. C. The Custom RPC interface is accessible even when MetaMask cannot connect to whatever network it's trying to connect to, so that the user can switch to a network they can connect to. This is consistent with @danfinlay's comment on issue #1983. Note: Being able to access the CustomRPC UI while logged out, regardless of "Connecting..." overlay, is issue #5606; the expected behavior here is access to that UI when the "Connecting..." overlay is in place (even if logged in), instead of the overlay removing access to UI elements that allow logging in or changing RPC.

Browser details (please complete the following information):

MicahZoltu commented 5 years ago

This has gotten significantly worse in the latest version of MetaMask. Now when you get into this state there is not even ea non-obvious workaround. The extension is effectively totally broken until you can bring up whatever node you were pointing at or wipe out the extension and re-install. If you are lucky, the custom node you were pointing at is something you control and can bring up again, not a remote node that has gone offline and will never return.

This bug is likely to effect anyone who uses something like QuikNode, since those addresses can change between billing cycles and you can never get them back once they are gone.

Notice how there is no longer any buttons to click on at all. 😢 image

bdresser commented 5 years ago

@MicahZoltu this is being addressed in https://github.com/MetaMask/metamask-extension/pull/5893: we'll time out the connection attempt and prompt you to switch networks. Agreed, long overdue.

Closing this as a duplicate of the older https://github.com/MetaMask/metamask-extension/issues/3776. Thanks for the thorough writeup.