Walletconnect - blocked by CORS policy

Hi, hope someone can help. I’ve read several post regarding this issue or similar to these. Most of them seems that fixed by magic. I’ve been facing this issue for 3 days and still not able to get over it.

I have no issue to connect via metamask. these errors only happen on walletconnect. My observation is no issue to authenticate/connect via walletconnect (no error). Errors will start popup out on the console after connected for 3-5 seconds and will continue get the several new error entries per seconds.

I tried pasting the https://speedy-nodes-nyc.moralis.io/WalletConnect/bsc/mainnet%20net on browser, then I’m getting " You are being rate limited" by cloudflare.


I tried restarted moralis server. I deleted the server and re-create. can’t resolve.
Can someone help?

There is a rate limit per IP on how many requests can be made to that RPC url specific to wallet connect that is a public RPC url. That could be a reason why you could get that error in testing if you test it few times.

thanks for the info.
any idea what is eth_blockNumber? it keeps generating requests to moralis server
image

it looks like it tries to get the last block number, it could do that in order to know when it passed a number of block in order to check if the transaction made it to the chain

anyone can help to solve this?

you say that it makes continuous requests to that wallet connect RCP endpoint?

it will get rate limited if it happens to make a lot requests

yeah… i understand the needs of rate limit at moralis firewall side.
But I don’t understand why this only happens when connect via walletconnect. No such issue with browser extension metamask. I tried tokenpocket browser no issue as well

when using metamask extension, a different RPC url will be used, the one that is added in metamask configuration, and also, metamask may not make the same number of requests

I don’t know now why walletconnect would make so many requests to that RPC url, you don’t even need to connect to the RPC in order to authenticate, only when you want to make a transaction

1 Like

Hey Kim…was having the same issue. Took me the whole day to get a solution.
Not the best but its working…

There is a problem with the Wallet_connect web3 provider.
https://github.com/WalletConnect/walletconnect-monorepo/releases/download/1.7.8/web3-provider.min.js

async _updateLatestBlock() {
	const t = await this._fetchLatestBlock();
	this._newPotentialLatest(t)
}

I just saved the file locally and edited this function with a little wait time. The function was called to often so the Request Rate Limit error was caused.

async _updateLatestBlock() {
        console.log("Updating latest Block");
        const waitFor = delay => new Promise(resolve => setTimeout(resolve, delay));
        await waitFor(1500);
	const t = await this._fetchLatestBlock();
	this._newPotentialLatest(t)
}

Not the best solution…but it works.

3 Likes

I realised walletconnect will start this RPC request as soon as I press “Connect” on metamask and will continue do so until I disconnect (localstorage.clear and moralis.user.logout).
My understanding is that walletconnect try query the latest update constantly from the node (moralis in this case) while moralis’s firewall (cloudflare) configured to limit the request.

thanks for the workaround. I tried and I even increased it to 60000. 0 Errors! but not usable. Update is too much delay.

I’m now using your workaround and set the delay to 5000 and keep my finger crossed!!