[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 127.0.0.1 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