Error in fetchign data Error: offset must be less than 500

So I am trying to get all the assets of a collection. So for that, at first request, I am fetching first 500 assets, and then I am using a loop which uses offsets to fetch rest of the assets. On each request I am increasing offset by 500. But its giving this error.

error in fetchign data Error: offset must be less than 500
at Function.fetchFromServer (C:\Users\vb852\Desktop\FinalRaritySniper\Backend\node_modules\moralis\lib\node\MoralisWeb3Api.js:232:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)

So how its gonna work? If offset is less than 500, then How I will skip like 1000 elements, to fetch assets from 1000-1500 ?

Some users are reporting issues with offset; can you give an example of that last or failing request?

You may have to switch to using cursor (the cursor property from the current query will return the next page). Here’s an example of using it: getNFTsForContract Offset Not Working

1 Like

it seems to be still not working, any update on the offset issue?

We made a change so most of the endpoints to use only cursor for pagination. You can find an example here on how to use cursor.

https://docs.moralis.io/misc/rate-limit#example-of-how-to-use-cursor-nodejs

We will be adding a simpler syntax for cursor in the near future too.