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

Rainbowkit unable to connect to metamask sometimes #1759

Closed
1 task done
jtfirek opened this issue Feb 8, 2024 · 15 comments
Closed
1 task done

Rainbowkit unable to connect to metamask sometimes #1759

jtfirek opened this issue Feb 8, 2024 · 15 comments

Comments

@jtfirek
Copy link

jtfirek commented Feb 8, 2024

Is there an existing issue for this?

  • I have searched the existing issues

RainbowKit Version

1.3.5

wagmi Version

1.4.13

Current Behavior

When the user presses the metamask button and they have metamask installed, rainbow kit thinks they don't have metamask and doesn't connect

Expected Behavior

When the user presses the metamask button and they have metamask installed, they should have a pop up from metamask to connect to the site

Steps To Reproduce

Link to Minimal Reproducible Example (CodeSandbox, StackBlitz, etc.)

No response

Anything else?

Screenshot 2024-02-07 at 10 25 15 PM
@magiziz
Copy link
Contributor

magiziz commented Feb 8, 2024

@jtfirek Thanks for reporting this issue 👍

If you try to disable other wallet extensions and only keep metamask would that work ? If that would work it's a problem with the EIP1193. Meaning the other wallets can block the access for metamask to work and override window.ethereum. I see you also have coinbase wallet and many people have issues with that as well.

But we're releasing RainbowKit v2 soon and we will introduce EIP6963 which should fix this issue.

Let me know if this is helpful 🙏

@magiziz
Copy link
Contributor

magiziz commented Feb 12, 2024

@jtfirek We just released RainbowKit v2. Do you mind upgrading to the latest version and let me know if the issue still persists ?

@Frontend-io
Copy link

Frontend-io commented Feb 13, 2024

Thanks @kosmoskey, facing this same issue, I have just upgraded to v2 but the issue persists.

If you try to click on Metamask (using the Customer Walletbutton) in your documentation, it doesn't work as well, but connecting through the modal works: https://www.rainbowkit.com/docs/wallet-button

@magiziz
Copy link
Contributor

magiziz commented Feb 13, 2024

@Frontend-io Does it not work with RainbowKit modal or does it not work with WalletButton ?

In your case it's a wallet that overrides window.ethereum's metamask which blocks metamask being detected in the RainbowKit modal. We're still using EIP-1193 for <WalletButton /> specifically, but should work just fine like this:

image

Please try to disable all of your wallets apart from metamask and try connecting again please. If it doesn't work please go to inspect element -> console -> type in window.ethereum and see if it shows anything.

@Frontend-io
Copy link

Frontend-io commented Feb 14, 2024

Thanks, @kosmoskey, I think that is the case (that another wallet overrides it). I tried with another browser with only metamask installed and it worked fine. window.ethereum returns the ethereum object with {..., isMetamask: true}

My other wallets are useful as well, is there a way around this just uninstalling the other wallets?

@magiziz
Copy link
Contributor

magiziz commented Feb 14, 2024

Thanks, @kosmoskey, I think that is the case (that another wallet overrides it). I tried with another browser with only metamask installed and it worked fine. window.ethereum returns the ethereum object with {..., isMetamask: true}

My other wallets are useful as well, is there a way around this just uninstalling the other wallets?

With RainbowKit connect modal it should work just fine. Just make sure you enable the metamask + with other wallets and click "MetaMask" on the "Installed" section. There should be no conflict due to the new EIP-6963 feature we've added.

image

Regarding the <WalletButton /> we'll add support for that soon, but even wallets like Coinbase wallet are causing issues with window.ethereum overrides. Usually it's the wallets faults for causing those conflicts, but should be fixed specifically for <WalletButton /> soon.

@Frontend-io
Copy link

Thanks for the quick responses @kosmoskey . Yes, before i fix is released for the WalletButton, i've temporarily removed coinbase wallet, my metamask works fine now. Coinbase wallet was the one overriding it. Much love ❤️

@magiziz
Copy link
Contributor

magiziz commented Feb 14, 2024

@Frontend-io Sounds good. We will make sure to add support for WalletButton with EIP-6963, but happy that it works with connect modal for now.

@magiziz magiziz closed this as completed Feb 14, 2024
@duong-doan-dev
Copy link

I also face this problem with WalletButton. Tried to connect to Metamask but the address is of Zerion wallet. Maybe I should use Modal for now. Hopefully EIP-6963 will be applied to WalletButton soon

@magiziz
Copy link
Contributor

magiziz commented Feb 16, 2024

I also face this problem with WalletButton. Tried to connect to Metamask but the address is of Zerion wallet. Maybe I should use Modal for now. Hopefully EIP-6963 will be applied to WalletButton soon

Yes use Modal for now and we'll add support for EIP-6963

@wahabshah21
Copy link

Hi I have just this issue that my metamask would connect properly but then sometimes after I disconnect it and try to connect it I get the modal message like "Opening MetaMask. confirm connection in extension..." but the metamask doesnt open. Then if I refresh the page it starts working again.

Is it some cache issue with rainbowkit or maybe provider and I need to reset it somehow on disconnection?

image

@magiziz
Copy link
Contributor

magiziz commented Jul 24, 2024

@wahabshah21 Did you upgrade your wagmi version to 2.12.0 ?

@wahabshah21
Copy link

No I am using 2.9.10. Will upgrading it solve the issue?

@DanielSinclair
Copy link
Collaborator

@wahabshah21 I believe so. Wagmi improved how they handle connectors in this recent release. Let us know if your issue resolves after upgrading; there shouldn't be any breaking changes beyond that.

@wahabshah21
Copy link

Hi. I am facing one strange issue.

All of a sudden happened, when I click on wallet connect the rainbowkit modal opens and then once metamask is selected, metamask opens. After I click the connect button in metamask, it shows connecting and the closes but wallet isnt connected and I see the retry button in rainbowkit Modal.

Even after clicking on retry same thing happens as explained above. However if I go manually in metamask extension, choose different account to connect then it starts working and then I can switch between accounts too.

Same issue after disconnecting the wallet again.

I am curios because it started happening this morning and it was working previously perfectly. What could be the possible issue?
I have updated the version of both wagmi and rainbowkit wallet (to latest ones). But Still facing this wallet connection issue.

Any help or direction is appreciated.

Keeps on showing this even after confirmed from metamask (screenshot attached below)

image

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

6 participants