141:Invalid JSON RPC response: "error code: 1020"

Hi. @cryptokid

Yesterday, @kresimir help me to upgrade our server to higher production. The lagging is reduced.

Now we have another problem:
There is some requests always return "141:Invalid JSON RPC response: “error code: 1020"” for almost all users:
For example: https://atl5nkrrpg3m.usemoralis.com:2053/server/functions/getMarketOffers

(You can check at your end. When I call this function 10 times, 9 times it shows that error)

Another example is POST to https://atl5nkrrpg3m.usemoralis.com:2053/server/functions/getTotalUnClaimedBattles

I cannot know how to fix it. And there are other requests that have that problem.

Can you tell me how to fix it?

you could try to init web3 with a code like this:

web3 = new Moralis.Web3(new Moralis.Web3.providers.HttpProvider("https://speedy-nodes-nyc.moralis.io/YOUR_ID_HERE/bsc/mainnet"));

now it is const web3 = Moralis.web3ByChain(_chain);


Can you help have a look at my video record:

I call the same function from Moralis console, and 10 times, there are 5 times it returns difference errors.

This is really unstable, and we cannot scale our user base with this problem.

Please help me check if something wrong with my server configuration.

Yesterday, @kresimir help me upgrate the rate limit to 15.000 reqs/min.


can you update your server to latest version?

I just restarted the server to update to lastest version. It is still loading.

done done done done done done (for 20 characters…)

now that error with 1020 code should be fixed

I see some errors of this type now web3 api fetch error: tokenId is required

Now it have diference rate limited error.


Error: This Moralis Server is rate-limited because of the plan restrictions. See the details about the current rate and throttle limits: {“x-rate-limit-limit”:“15000”,“x-rate-limit-remaining”:“16”,“x-rate-limit-remaining-ttl”:“16”,“x-rate-limit-throttle-limit”:“250”,“x-rate-limit-throttle-remaining”:“1”,“x-rate-limit-throttle-remaining-ttl”:“1”,“x-rate-limit-throttle-used”:“959”,“x-rate-limit-used”:“5763”}

the problem seems to be that “x-rate-limit-throttle-used”:“959”, this means that too many requests are done in 1 second, you have a rate limit of 15000 requests per minute, but there is also a limit of 250 requests per second, you can not make 1000 request in a second.

Can I control which client is calling too much request so I can have some restriction?

you can set restrictions with this: https://docs.moralis.io/moralis-server/web3-sdk/rate-limit in general for all the clients

So the restriction config here is for one client, correct? I should restrict one client to 1 request/sec for example?

yes, that restriction is for one client, you can restrict them to 1 request per second if you want


That’s impossible, because even with a single call to the chain in the Cloud function, for example ERC721.ownerOf (), all of our server requests are blocked with error 1020.

Our CCU is below 1000. I think it’s impossible for us to develop a Dapp with this restriction?

do you still have this error 1020 now?

Yes, a lot. and the CPU often ~ 100%. We have to sacrify a lot of onchain checking to reduce number of requests, but still lagging…

it looks like most of the processing power is used by Mongo DB now on your server

can you send me a DM on Discord?

@cryptokid: Please tell us your Discord, or Telegram should be better.