I have integrated the MetaMask with Angular and while opening up the MetaMask extension from the code I am getting this error.
Following is my code for opening up the extension. I am calling this function on a click to open MetaMask where its giving that error
MetaMask - RPC Error: Permissions request already pending; please wait. {code: -32002, message: "Permissions request already pending; please wait."}
ethEnabled(template?): any
{
if ((window as any).web3)
{
(window as any).web3 = new Web3((window as any).web3.currentProvider);
(window as any).ethereum.enable();
console.log((window as any).ethereum.enable());
}
else
{
this.modalRef = this.modalService.show(template);
}
}
I have integrated the MetaMask with Angular and while opening up the MetaMask extension from the code I am getting this error.
Following is my code for opening up the extension. I am calling this function on a click to open MetaMask where its giving that error
MetaMask - RPC Error: Permissions request already pending; please wait. {code: -32002, message: "Permissions request already pending; please wait."}
ethEnabled(template?): any
{
if ((window as any).web3)
{
(window as any).web3 = new Web3((window as any).web3.currentProvider);
(window as any).ethereum.enable();
console.log((window as any).ethereum.enable());
}
else
{
this.modalRef = this.modalService.show(template);
}
}
Share
Improve this question
asked Nov 24, 2020 at 5:34
Ahmer KhanAhmer Khan
7671 gold badge10 silver badges31 bronze badges
3 Answers
Reset to default 12This error is actually expected; it happens when you've already submitted a permissions request, but the user has either not logged into MetaMask or not granted permissions to your app.
If the user logs into MetaMask and accepts the permissions request, this error will not occur anymore.
This is explained in the docs, where it says You should always disable the "connect" button while the connection request is pending
(otherwise this error occurs).
Here is one way to handle this:
- Disable the button while the request is pending
- If the user is not connected after a certain waiting period (10-20 seconds, perhaps?), show a message under the button requesting the user to plete the MetaMask connection.
There is more information and a nice example in their docs here.
Describe the bug
When I close the unlock wallet popup while requesting eth accounts, I'm not getting any result. And when I request eth accounts again, I'm getting the following error MetaMask - RPC Error: Already processing eth_requestAccounts. Please wait.
Steps to reproduce (REQUIRED)
window.web3 = new Web3(window.ethereum)
const account = await window.ethereum.request({
method: 'eth_requestAccounts',
})
Have wallet locked Trigger request Close unlock popup Trigger request again Expected behavior
Receive error with specific code to know that unlock wallet has been closed as well as the transaction to be discharged from the processing pipe.
Clear your internet cache, temp files etc.