Moralis.Web3API.account.getNFTs returns 504 error

do {

  const response = await Moralis.Web3API.account.getNFTs({

    chain: "eth",

    address: "0xd6a984153acb6c9e2d788f08c2465a1358bb89a7",

    limit: 100,

    cursor: cursor,

  });

  cursor = response.cursor;

} while (cursor != "" && cursor != null);

when I run this code, sometimes the cursor stops and it returns a 504 error.

if you try again, you get same error?

yes, I get the same error.

this works fine for me:

response = await Moralis.Web3API.account.getNFTs({
    chain: "eth",
    address: "0xd6a984153acb6c9e2d788f08c2465a1358bb89a7",
    limit: 100,
    cursor: null,
  })

you tried now?

If cursor is null, it gets only 100 nfts, but I want to get all nfts.

ok, when did you try it last time to iterate over all the pages?
I would expect it to work now

you could add some logging in that script, maybe a delay, you can also add a retry in case of error

Thanks. Let me check.

I faced 2 issues.
image

Sometimes, it returns “read ECONNRESET” error.

And sometimes it returns “rate-limit” error.

Is there any way that I can upgrade it as much as high?

this particular rate limit can be set in server cloud code to a higher value

there is another rate limit that you can hit that you can raise with a better plan

Can you please let me know in more detail about both plans?

the rate limit error that you get there is not from a plan, you can look in that url from that error message to see how to set it in cloud code, in this case you can set any limit you want.

the other limit (that you don’t hit it yet) is of 25 requests/compute units per second for a free plan, 60 for a pro plan and after that it can be increased with custom plans by sending an email to [email protected]

Thanks. Let me check.

It works well now. Thanks :slight_smile:

1 Like