[UNRESOLVED] Cors error when using Walletconnect

I was happy to see this morning no CORS errors when testing WC! I thought you fixed somethingā€¦
But, now it started again and it seems to be related to the RPC being overloaded:

Whoā€™s working anyway on Sunday? :woman_mage:

Can you try again now to see if it is solved?

works fine at the moment, will post here if it happens again :+1:

would be an idea though to be able to override the RPC in options, for now thatā€™s a benefit of integrating outside of moralis. If 1 RPC is down itā€™s good to gave alternative options.

I think Iā€™m having a related issue here. I appear to be able to log-in via walletconnect. but when I call web3Provider.send("eth_requestAccounts", []); I get the CORS error:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://speedy-nodes-nyc.moralis.io/WalletConnect/eth/mainnet. (Reason: CORS header ā€˜Access-Control-Allow-Originā€™ missing). Status code: 401.

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