3

I am running a local ganache-cli and my metamask in my browser just keeps saying:

Oops! Something went wrong.

enter image description here

Here are the network details:

name: Localhost
RPC URL: http://localhost:8545
Chain ID: 1337

This started happening literally today, never had issues with it before. I don't think I changed any settings that would have affected this. I was just testing smart contracts locally like I normally do.

And my ganche-cli reflects this. I even make the JSON-RPC call for chainId, and this is correct.

Here is what I've tried:

  1. Switching browsers (brave -> chrome)
  2. Changing ports on both the ganache-cli, UI, and metamask
  3. Changing RPC_URL (to localhost, 0.0.0.0...) on both the ganache-cli, UI, and metamask
  4. Using the ganache app
  5. Uninstalling and reinstalling browsers
  6. Uninstalling and reinstalling metamask
  7. Turning computer off and on again
  8. Resetting account in the advanced config

I'm losing my mind. I am able to deploy contracts to the ganache chain via the command line.

Here is what else I've looked at: Metamask not connecting to localhost http://asifwaquar.com/connect-metamask-to-localhost/ https://github.com/MetaMask/metamask-extension/issues

8
  • 1
    Do you have other extension that may cause problems? I've the same configuration with Metamask on Firefox and Chrome without issues. Sometimes "reset account" in the Advanced menu fixed some odd issues with Metamask and ganache.
    – Ismael
    Commented Mar 6, 2021 at 21:03
  • Yep :( Tried that too. Commented Mar 6, 2021 at 21:08
  • Just for reference I've just tested with Ganache CLI v6.12.1 (ganache-core: 2.13.1) under node v12.20.0 with Metamask v9.1.1 and it worked.
    – Ismael
    Commented Mar 6, 2021 at 21:20
  • 1
    my ganache get always 5777 as network id, can you change it to that
    – Majd TL
    Commented Mar 6, 2021 at 21:54
  • 1
    Yep :( I get The endpoint returned a different chain ID: 1337 Commented Mar 6, 2021 at 22:01

3 Answers 3

2

Got it.

Both my Brave browser and Google Chrome were having issues. I tested then on firefox and it worked fine. A reinstall of Google Chrome fixed the issue for Chrome. A reinstall of Brave did not fix it.

Looks like it's an issue with Brave Browser. Thanks all.

1

Ensure that you can really access your ganache-cli on localhost:8545 and the network id is 1337. Metamask asks for 'net_version' when connecting to the blockchain.

  1. Start Ganache with:
$  ganache-cli --networkId 1337
  1. Check with:
$ curl -X POST --data '{"jsonrpc":"2.0","method":"net_version","params":[],"id":67}' localhost:8545

expected result:

{"id":67,"jsonrpc":"2.0","result":"1337"}
6
  • Yep, tried this. Commented Mar 7, 2021 at 18:18
  • Was it successful? Commented Mar 7, 2021 at 19:46
  • The expected result from your answer yes, but metamask is still giving the same error from my original question Commented Mar 7, 2021 at 19:47
  • What operating system are you using? Did you try a clean install of Metamask with Firefox? Commented Mar 7, 2021 at 19:50
  • MacOS. Yes, uninstall and reinstalled metamask, and tried it on a few browsers Commented Mar 7, 2021 at 19:50
0

I had the same issue that metamask could not connect to my page. But in my case, I ran truffle migrate --reset and got back zsh: command not found: truffle and thus after npm install -g truffle, I ran truffle migrate and refreshed my page and it worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.