getTokenIDOwners problem

Hi moralis team,

I have one issue using moralis apis for ERC1155.
I have several ERC-1155 nfts now.
So, I tried to get all owners from the ERC-1155 NFTs using getTokenIdOwners functions.
But, it returns 400 error(limit error) because this function has too many requests(maybe 20 requests)

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โ€:โ€œ25โ€,โ€œx-rate-limit-remaining-ttlโ€:โ€œ5โ€,โ€œx-rate-limit-usedโ€:โ€œ40โ€,โ€œx-rate-limit-remaining-ip-ttlโ€:โ€œ5โ€,โ€œx-rate-limit-ip-usedโ€:โ€œ40โ€}

for (let nft of NFTs) {
let metadata = null;
//get metadata
const options = {
address: nft.token_address,
token_id: nft.token_id,
chain: process.env.REACT_APP_CHAIN_ID
};
const result = await Moralis.Web3API.token.getTokenIdOwners(options);
โ€ฆ โ€ฆ
}

How can I fix this issue?

Hope your quick help.

Regards.

1 Like

you can fix it easily by adding a delay of 1 second between requests.

@cryptokid
Thanks for your reply.

Surely, I thought about it.
But if I have 1000 nfts, it will take 1000s.
I think it is not the correct solution.

Is there more sufficient and efficient solution?

Cheers.

there is another solution where you can upgrade your account to PRO plan, in that case you can do 60 requests/compute units per second vs 25 with a free plan

you can try with a delay of 0.5 seconds too, there will be 500 results per page

@cryptokid
Are you sure upgrading free plan will solve this issue fully?
Sorry, I need your correct answer.
So, I can notice it to my client.
Thank you.

with pro plan you can do 2.4 more requests in a second compared to a free plan, I donโ€™t know if it will solve the problem completely.

Okay, got it.
Thank you very much.

Thanks for the answer. Please could you give some guidance on how to add delays between requests? I am using react.

Thanks a lot.

You can use setTimeout as a basic way. There is an example here.

1 Like