Rate Limit After Upgrading To Pro

Hello,

I hope you are well. I am having some issues with RateLimits/Throttle.

"error: "Too many requests to Web3 API from this particular client, the clients needs to wait before sending more requests. This can be adjusted using Moralis.settings.setAPIRateLimit. Read More: https://docs.moralis.io/moralis-server/web3-sdk/rate-limit."

I have upgraded to a Pro plan, but my server is still responding with this error.

I am calling …

      const nfts = await Web3Api.account.getNFTs({
          address: account as string,
          chain: chainId,
        });

This is returning about 500 results for the currently selected account.

Following advice from Rate limit per second? and other forum posts i am getting the metadata in batches for each time. I’ve set batch size to 50, but am filtering on token_type ERC721 so the first batch is only 38 items long when making the getTokenIdMetadata request.

I have upgraded my plan from free to Pro, but am still using the server i created during my free period.

for (let i = 0; i < nfts.result.length; i += batchSize) {
            for (let j = 0; j < batchSize; j += 1) {
              const nft = nfts.result[i + j];
              if (nft.contract_type === "ERC721") {
                  const options = {
                    address: nft.token_address,
                    token_id: nft.token_id,
                    chain: chainId,
                  };
                  promises.push(Web3Api.token.getTokenIdMetadata(options));
                }
            }
            const metaDataRes = await Promise.all(promises);
            res.push(...metaDataRes);
          }

I have also read…https://docs.moralis.io/moralis-server/web3-sdk/rate-limit which only tells you how to SET rate limits, but not understand the current rate limit set.

Can you provide some advice on this please?

Regards,

Daniel

You can configure that rate limit by adding that code example in cloud code. There are two different rate limits. This one is something that you can control from cloud code on your server.

Ok. What are the defaults? What are good settings to raise it to?

getTokenIdMetadata is a Moralis API function not one of my cloud code functions.

I’ve added a setting at the top of the cloud code file, it took awhile to save the changes.

But still seeing the same issues. My user isAuthenticated, still seeing the same error message in the browser’s network tab.

I’ll try again in a few hours, but please let me know if i am doing anything wrong here.

try with different settings values there, try to also update your server to the latest version

Had to increase the rate for unauthenticated users. The current user is authenticated, so something is not right/named correctly.,

did you update the server to latest version?

Yes. Although that did not fix it, it was the rate limit adjustment that appears to have worked.