Closed malinskibeniamin closed 10 months ago
Thanks for reaching out. Can you verify if this eventualy resolves (and whether this is an async timing issue) or if it stays empty?
Thanks for reaching out. Can you verify if this eventualy resolves (and whether this is an async timing issue) or if it stays empty?
@frederikprijck Thanks for a quick reply! This has been an issue in our integration environment, it can be reproduced consistently both locally and with a deployed API - we have fixed it by adding an if statement so that despite the next
property being provided when no results are remaining to be fetched, we just omit that part and return the previous list. We had to add a test scenario to mirror this behaviour, it caught us by surprise given the docs specified otherwise.
Originally I figured some records must have been deleted right at that moment, but it's not true. Auth0 always returns next
1 additional time for us - we still attempt to fetch more results, at which point we double check the list is not empty, just as a sanity check.
Disclaimer: I would suggest we add an extra type where there is a members
property without next
field present, as that is what we were getting.
I don't think this is anything related to the SDK, nor something we can solve from our SDK side. Our SDK passes through anything the API returns.
Can you verify the same response is returned if you call the API outside of our SDK?
If so, i recommend reaching out to your point of contact at auth0 to get you in touch with the correct team, that way this issue can be looked at more directly and it will be easier to troubleshoot.
As I was curious what could be causing this I looked into this and I was able to reproduce this. After further investigation, it turns out this is how the checkpoint pagination works.
It is expected that if the last page contains exactly the same amount of items as the take
parameter, a next will be included that points to an empty page.
Closing this as it seems to work as designed, you can always pass along the feedback to your contact at Auth0 or provide feedback here.
Checklist
Description
According to Auth0 docs, if we request a list of members, we can get either of these types:
Unfortunately, in Auth0 docs page under Checkpoint Pagination, it says you will only get the
next
property if there are more records to be retrieved, but at times the fetch will yield 0 results (empty array will get returned).We should either update the docs to say that there might be an empty list despite the
next
cursor being provided, or fix the issue if it's a bug.Reproduction
auth0.organizations.getMembers()
next
next
cursor page tokenAdditional context
No response
node-auth0 version
v4.1.0
Node.js version
v18.12.1