-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@vercel/blob: pagination with limit: N, N <1000 #835
Comments
Hey there @gheorghemolnar I just tested your setup and could not generate the same issues. Here's my script: import { list } from "@vercel/blob";
async function listFilesTwoByTwo() {
let hasMore = true;
let cursor;
const limit = 2;
while (hasMore) {
const {
blobs,
cursor: newCursor,
hasMore: newHasMore,
} = await list({ limit, cursor });
console.log(blobs.length, typeof newCursor, newHasMore);
cursor = newCursor;
hasMore = newHasMore;
}
}
listFilesTwoByTwo(); And the result: > BLOB_READ_WRITE_TOKEN="xxx" node test.js
2 string true # Good
2 string true
2 string true
2 string true
2 string true
2 string true
2 string true
2 string true
1 undefined false # Good Can you confirm my script output is the one you would expect? And check why you're getting a different result, thanks! |
Hi @vvo , thank you for your quick response. But in my case, i'm not using it in one loop, that gets all the results.
Thank you again |
I'm currently evaluating the @vercel/storage blob in my project and I came across this pottential issue while using list with pagination.
Context:
Problem Description:
i'm issuing the first request with no cursor
on the 2nd request, I put the cursor and its previously received value, in query
The behaviour of the 2nd request is happening for the followings request:
- cursor populated every time with a differrent string value
- hasMore is polpulated with true, event if it should return hasMore: false (ex. on the 4th time call of the 'limit' function).
I can get all the results (6 of them), only if I don't specify the limit in the optional parameters of the limit function.
Can you give me some insights on this ?
Thank you !
The text was updated successfully, but these errors were encountered: