0

I'm having a problem using Metamask with Ethers.js. I have the following set-up:

Metamask installed on Edge browser.
Hardhat localhost node.
Node.js localhost http server.

I can connect to Hardhat via Metamask without any problems, but if I close the browser and open it again (or just "Lock" Metamask to logout) I can no longer connect to Metamask and instead get this error:

RPC Error: Already processing eth_requestAccounts. Please wait. {code: -32002, message: 'Already processing eth_requestAccounts. Please wait.'}

No matter how long I wait I get the above error. I understand what the message means, but don't see any reason why it should appear in these circumstances.

Here's my (abbreviated) code:

provider = new ethers.providers.Web3Provider(window.ethereum);
await provider.send("eth_requestAccounts", []);

I want Metamask to pop-up as normal and ask for a password and it doesn't. I have to open Metamask, login, disconnect "localhost" from the list of connected sites, then I can connect via the above code. But as I said, if I then logout of Metamask or close and re-open the browser, I get the RPC error.

I'd really appreciate any help on this!

0

Your Answer

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

Browse other questions tagged or ask your own question.