SERVER_ERROR: The method eth_requestAccounts does not exist/is not available

I’m developing a HTML/JS webpage and included ethers-5.6.umd.min.js
In the javascript code I added the following lines to prompt the MetaMask dialog:

const provider = new ethers.providers.JsonRpcProvider(“…”);
await provider.send(‘eth_requestAccounts’, []);

The MetaMask dialog is not shown and I see the following error message in the console:

ethers-5.6.umd.min.js:1 Uncaught (in promise) Error: processing response error (body="{“jsonrpc”:“2.0”,“id”:49,“error”:{“code”:-32601,“message”:“The method eth_requestAccounts does not exist/is not available”}}", error={“code”:-32601}, requestBody="{“method”:“eth_requestAccounts”,“params”:[],“id”:49,“jsonrpc”:“2.0”}", requestMethod=“POST”, url=“…”, code=SERVER_ERROR, version=web/5.6.0)
at Logger.makeError (ethers-5.6.umd.min.js:1:60521)
at Logger.throwError (ethers-5.6.umd.min.js:1:60726)
at ethers-5.6.umd.min.js:1:484366
at step (ethers-5.6.umd.min.js:1:477596)
at (ethers-5.6.umd.min.js:1:476856)
at fulfilled (ethers-5.6.umd.min.js:1:476230)

Update: Already found the issue, I could not parse the response while did not host the webpage on a server. Could close this issue.

Hello @blockdev, welcome to our community!

Thank you for taking the time to share the found solution :slight_smile: