[UNRESOLVED] Cors error when using Walletconnect

if you check in network tab, it was a timeout or really CORS error?

how would the RPC node know what to return for eth_requestAccounts?

it’s really a CORS error… the response is ‘unauthorized’

Screen Shot 2022-02-20 at 12.52.53 PM

it looks like trying to send a command (eth_requestAccounts) that it is not allowed by the node

" how would the RPC node know what to return for eth_requestAccounts?"

Not sure what you mean by this… I am not querying the node directly, the underlying Moralis.js library is doing that. I am just using the ethers.js way of asking for the list of associated accounts, using the provider handle returned by: const web3Provider = await Moralis.enableWeb3(). This method works fine on desktop with the injected provider, but fails when connecting through WalletConnect.

maybe that eth_requestAccounts command is specific to metamask

this is still Metamask, just via WalletConnect. I’m open to suggestions for alternatives. The problem I have is I need to know the currently selected wallet address, and that is typically returned at index 0 in the eth_getAccounts call. there is the const account = await Moralis.accountcall, however this does not appear to return the currently selected account, only the primary one.

not sure if this helps:

not really as that’s a web3.js call and not an ethers.js call, old post may no longer be applicable to the current state as the moralis.js library is ethers.js based now. But thanks.

you could make another forum thread about this

I’ll poke around a bit to see if I can find an alternate way that works for both wallet-connect and injected providers. but will for sure create a new thread if I can’t find a solution. Thanks again

@cryptokid I have the same problem, can’t find any solutions for this. This issue occurs when using Wallet connect with a QR code:

if you don’t use it with a QR code then it works fine?

did you also try with instead of localhost? or somewhere where https is enabled?

But now It’s ok in both localhost and HTTPS, I don’t change anything. It’s magic! I think this issue is in your server, it’s not stable.

1 Like

Having the same issue here guys

Moralis speedy nodes are no longer available.

You can update to code to get data from web3Api to get the data or you can use our partner nodes from here https://moralis.io/largenodes

What is the best solution in your opinion?
I’m confused because I don’t see how I can change it on my end. The node is being called from Moralis SDK.

There are few forum threads with the same issue. One possible solution could be to use latest version for walletconnect. Or to add some code that adds a delay for the requests that walletconnect does.

Same error updating walletconnect to the latest version 1.7.8 and Moralis 1.9.0

1 Like

Awesome, thanks… I’m gonna try it here