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

[Bug]: wallet_switchEthereumChain no longer working after update to 10.28.2 Chrome #18509

Closed
SolidityDevTech opened this issue Apr 7, 2023 · 71 comments · Fixed by #18513
Closed

Comments

@SolidityDevTech
Copy link

Describe the bug

After the release of 10.28.2 wallet_switchEthereumChain is no longer working. Error in console is {code: -32603, message: 'networkConfigurationId undefined does not match a configured networkConfiguration', data: {…}}. 10.28.1 has an issue where user has to approve the function twice. Downgrading to 10.26.1 allowed the wallet_switchEthereumChain to function. (Did not try versions between 10.26.1 and 10.28.1) It appears that the issue only happens when switching to a chain other than Ethereum but can not confirm 100%

Steps to reproduce

  1. Ensure that extension version 10.28.2 is installed in Chrome Desktop.
  2. Visit a site which utilizes wallet_switchEthereumChain, trade.coinbook.app is an example.
  3. Utilize Network dropdown on DAPP to select a chain to switch to. Metamask will open with correct chain swicth prompt. Error is logged after clicking Approve.
  4. Depending on DAPP configuration there may be a catch that calls wallet_addEthereumChain on error.

Error messages or log output

{code: -32603, message: 'networkConfigurationId undefined does not match a configured networkConfiguration', data: {…}}

Version

10.28.2

Build type

None

Browser

Chrome

Operating system

MacOS

Hardware wallet

No response

Additional context

No response

@nautsimon
Copy link

nautsimon commented Apr 7, 2023

bump, this was an issue before version 10.28.2 that #18483 aimed to fix but did not successfully do so

#18453

@0xnakato
Copy link

0xnakato commented Apr 8, 2023

same here

@simonzg
Copy link

simonzg commented Apr 8, 2023

same issue identified both on MacOS and Windows

@sjunaiduk
Copy link

Metamask v10.28.2 on Chrome has created this bug. Hopefully a fix soon.

@qqqzhch
Copy link

qqqzhch commented Apr 8, 2023

Metamask v10.28.2 on Chrome on MacOS Hopefully a fix soon.

@scotthconner
Copy link

scotthconner commented Apr 8, 2023

Also running into this. It's broken existing dapp deployments as well?

MetaMask - RPC Error: networkConfigurationId undefined does not match a configured networkConfiguration

@danjm
Copy link
Contributor

danjm commented Apr 8, 2023

If you are experiencing this, you can switch networks within MetaMask. Of course, we want to fix this properly so that you don't have to do that.

I am trying to understand the problem. Can someone who is experiencing this try the following:

  1. Open MetaMask
  2. Make sure you are on a network other than the one you are trying to switch to
  3. Open the network dropdown and delete the network you are trying to switch to by clicking the "X" next to the network.
  4. Go back to the dapp and refresh the page
  5. Click whatever button prompts you to connect to the network. It should prompt you to add the network.
  6. Confirm the addition of the network but DO NOT confirm switching to the network if you are shown that immediately, and click "Cancel" on the switch network prompt.
  7. In the dapp, click the button that will again cause the switch network prompt. This time, confirm the switching of the network.

If someone can try that and report the results, it can help with the investigation of this bug.

Also, if someone can share any dapps where they are experiencing this bug, it can help with the investigation.

@0xnakato
Copy link

0xnakato commented Apr 8, 2023

If you are experiencing this, you can switch networks within MetaMask. Of course, we want to fix this properly so that you don't have to do that.

I am trying to understand the problem. Can someone who is experiencing this try the following:

  1. Open MetaMask
  2. Make sure you are on a network other than the one you are trying to switch to
  3. Open the network dropdown and delete the network you are trying to switch to by clicking the "X" next to the network.
  4. Go back to the dapp and refresh the page
  5. Click whatever button prompts you to connect to the network. It should prompt you to add the network.
  6. Confirm the addition of the network but DO NOT confirm switching to the network if you are shown that immediately, and click "Cancel" on the switch network prompt.
  7. In the dapp, click the button that will again cause the switch network prompt. This time, confirm the switching of the network.

If someone can try that and report the results, it can help with the investigation of this bug.

Also, if someone can share any dapps where they are experiencing this bug, it can help with the investigation.

@danjm I can't even delete the network in step 3, the network is still there after confirming the deletion. Could it be a new issue?

Btw you can try our dapp experiencing the issue https://syncswap.xyz/

@danjm
Copy link
Contributor

danjm commented Apr 8, 2023

@0xnakato Ah, I see, you are right.

Well I understand the problem now and am working on a fix.

This bug will be experienced by anyone who added a network while on v10.27.0 or earlier, and are now on v10.28.1 or v10.28.2 and trying to confirm a dapp prompted switch to that network. This bug will not affect users who first added the network, via a dapp wallet_addEthereumChain request, while on v10.28.1 . This bug also won't affect users who added the network via the MetaMask UI in v10.28.1

The simplest work around is to open MetaMask and use the network switcher. But you will have to do that every time a dapp prompts you to switch to that network.

If you want to permanently fix the issue for a given network, you can open MetaMask, then open "Settings", then select the "Network" tab of settings and edit any field in any way. Save the change in the network form. Switching to this network from dapp (or deleting it) will succeed. I have demo's this workaround in the attached video, which first shows the failure to switch and then shows the successful network switch after editing the rpc url in the network form by adding a trailing /

switchnetwork-workaround.mp4

@0xnakato
Copy link

0xnakato commented Apr 8, 2023

@danjm Awesome! Thank you for the investigation, details and instructions! Really appreciate it and looking forward to the fix!

@mykcryptodev
Copy link

thank you @danjm I think your explanation probably saved me hours of fumbling this weekend <3

@RodeRickIsWatching
Copy link

RodeRickIsWatching commented Apr 9, 2023

@danjm Facing the same problem, and temporarily fixed by removing and readd the network. BTW will u fix it in this version? I think it may be a liitle complex for common users to understand why they need to remove and readd the network, and also how to do it. Thanks!

@mhmmdhajizade
Copy link

mhmmdhajizade commented Apr 9, 2023

@danjm Thank you for explanation. This solution fixed the problem but is there any chance that this problem fix in next versions of metamask? It is gonna be big problem for dapps that using metamask for connect wallet.

@Jason2d2
Copy link

Jason2d2 commented Apr 9, 2023

This is still causing issues since 10.28.1.
Have you tried switching to a custom network, Ganache? I am able to switch via dapp to a common network, like Sepolia, but unable to switch to Localhost http://127.0.0.1:8545, chain id 1337.

Error:
networkConfigurationId undefined does not match a configured networkConfiguration

@bifot
Copy link

bifot commented Apr 9, 2023

same for me, and also on uniswap too

@Bot80926
Copy link

Bot80926 commented Apr 9, 2023

can't delete network successfully. the only way to switch network is open metaMask and use network switcher :(

@0xnakato Ah, I see, you are right.

Well I understand the problem now and am working on a fix.

This bug will be experienced by anyone who added a network while on v10.27.0 or earlier, and are now on v10.28.1 or v10.28.2 and trying to confirm a dapp prompted switch to that network. This bug will not affect users who first added the network, via a dapp wallet_addEthereumChain request, while on v10.28.1 . This bug also won't affect users who added the network via the MetaMask UI in v10.28.1

The simplest work around is to open MetaMask and use the network switcher. But you will have to do that every time a dapp prompts you to switch to that network.

If you want to permanently fix the issue for a given network, you can open MetaMask, then open "Settings", then select the "Network" tab of settings and edit any field in any way. Save the change in the network form. Switching to this network from dapp (or deleting it) will succeed. I have demo's this workaround in the attached video, which first shows the failure to switch and then shows the successful network switch after editing the rpc url in the network form by adding a trailing /

@iseekTo
Copy link

iseekTo commented Apr 10, 2023

@Bot80926 Yes, you are right, this is really a bad ux :(

hope Metamask can fix it :)

@Holybasil
Copy link

waiting for a fix

@xl2412
Copy link

xl2412 commented Apr 10, 2023

same for me, waiting for a fix

@zenland-dao
Copy link

Worked fine with Metamask Version 10.28.2 and Chrome Version 111.0.5563.65. Decided to update Chrome to 112.0.5615.50 - network switch stopped working. Tested on Zenland App

@luneShaoGM
Copy link

luneShaoGM commented Apr 10, 2023

same for me, Metamask Version 10.28.2 and Chrome Version 111.0.5563.146.

@egorbond31
Copy link

egorbond31 commented Apr 10, 2023

same, waiting for a fix 🙏

@kuilaurence
Copy link

First remove the previously added network, then re-add it, and the network switching works again. It is speculated that this is related to a Chrome update.

@Sotatek-DungTran2
Copy link

Sotatek-DungTran2 commented Apr 10, 2023

Hi all with this issues , I solved with change method call wallet _switchEthereumChain to wallet_addEthereumChain.
And in config wallet_addEthereumChain you change property rpcUrls : ['rpc_url/'] ( Example for abitrum network
rpcUrls: ["https://arb1.arbitrum.io/rpc/", "https://rpc.ankr.com/arbitrum/"], )
Summary The metamask document recommend use wallet_addEthereumChain for switch network and with method wallet_addEthereumChain you can config all for network ( name , chainID , rpc )

@nmikhaylovskiy
Copy link

Hi
I have same problem

Wait for fix

@livingrockrises
Copy link

waiting for a fix

@LevanOzashvili
Copy link

same issue on multiple dapps.
waiting for a fix.

@happy-cutman
Copy link

Chrome version 112.0.5615.50 issue is still here

@fachryadhitya
Copy link

Chrome version 112.0.5615.50 issue is still here

same :(, did you find the fix?

@soumayaerradi
Copy link

Same issue here

Screenshot 2023-04-12 at 09 48 37

@veltechg
Copy link

@danjm Noticed this issue is still persisting on Chrome v. 112.0.5615.49. Thank you

@AtelyPham
Copy link

You might want to try removing the network from your Metamask Settings in the network tab and re-adding it from the dapp. Doing so helped me resolve the issue. Hope this helps!

@Markcode1992
Copy link

Is there an estimated date for this fix?

@sk-enya
Copy link

sk-enya commented Apr 12, 2023

Facing same issue, waiting for fix to publish.

@SolidityDevTech
Copy link
Author

I just manually installed 10.28.3 and all looks good now. The latest release is not available in Chrome Web Store quite yet, please wait for it to be released and currently installed extensions to be updated and then everything should work as expected.

@petermazzocco
Copy link

Seems to be working for me now. I followed a couple of the steps above:

  1. Removed a network I was trying to force a switch over to.
  2. My connectWallet function would manually add the network by running the wallet_addEthereumChain method.
  3. Now I can open up my dApp with a different chain, click Connect Wallet and it will ask to change to the proper chain and it works without error.

I am running version 10.28.2 btw.

@3commascapital
Copy link

still seeing this. running 10.28.2 as well

@mobiledev-111-118
Copy link

Cannot switch network in MM for all chains.

@cawfree
Copy link

cawfree commented Apr 13, 2023

@petermazzocco Nice find! Though possibly a little complicated for average users to follow.

@danjm
Copy link
Contributor

danjm commented Apr 13, 2023

Thanks everyone for your patience. The fix for this has now been rolled out to all chrome/brave users v10.28.3

@DavLiendoProgramming
Copy link

Still seeing this issue when trying to change testnets between sepolia and mumbai.
Metamask 10.28.3

@jgomes79
Copy link

Me too.
Still getting this error: networkConfigurationId undefined does not match a configured networkConfiguration
Metamask 10.28.3

@ArthurGerbelot
Copy link

Ping! Still have the issue with 10.28.3 too !

@cnaize
Copy link

cnaize commented Apr 25, 2023

The same issue

Mac M1
macOS 13.3.1
Google Chrome 112.0.5615.137
MetaMask 10.28.3

@james-carr-siftware
Copy link

Still an issue

MetaMask 10.28.3
Chrome 112.0.5615.165
Ubuntu 22.04

@sgraphics
Copy link

Apparently its due to specifying capital casing for network id when calling wallet_switchEthereumChain. So instead of 0xAA36A7, use 0xaa36a7 for Sepolia.

This is definitely still a bug as many online documents explicitly advise to use the capital case version (e.g. https://docs.alchemy.com/docs/how-to-set-up-the-metamask-sdk). Also online dec-to-hex converters (such as https://www.rapidtables.com/convert/number/decimal-to-hex.html) report CAPITAL case versions for the conversion.

@sgraphics
Copy link

Apparently there is a fix: 0ea765e

@lxl8888
Copy link

lxl8888 commented Mar 8, 2024

@0xnakato Ah, I see, you are right.

Well I understand the problem now and am working on a fix.

This bug will be experienced by anyone who added a network while on v10.27.0 or earlier, and are now on v10.28.1 or v10.28.2 and trying to confirm a dapp prompted switch to that network. This bug will not affect users who first added the network, via a dapp wallet_addEthereumChain request, while on v10.28.1 . This bug also won't affect users who added the network via the MetaMask UI in v10.28.1

The simplest work around is to open MetaMask and use the network switcher. But you will have to do that every time a dapp prompts you to switch to that network.

If you want to permanently fix the issue for a given network, you can open MetaMask, then open "Settings", then select the "Network" tab of settings and edit any field in any way. Save the change in the network form. Switching to this network from dapp (or deleting it) will succeed. I have demo's this workaround in the attached video, which first shows the failure to switch and then shows the successful network switch after editing the rpc url in the network form by adding a trailing /

switchnetwork-workaround.mp4

I also encountered this problem on the metamask app version 7.17.0, and the two versions of the same two mobile phones, one is normal, the other will report this error {code: -32603, message: 'networkConfigurationId undefined does not match a configured networkConfiguration', data: {…}} !Looking forward to answer!

@KBPsystem777
Copy link

Looks like this is an issue when there are wallet that are also installed as an extension other than Metamask see -- https://stackoverflow.com/a/77457807

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