I am using AWS ListObjectsV2 to iterate over S3 keys. There are more than 1,000 keys, so the output returns me IsTruncated=true
as it should. However the ContinuationToken
is empty which makes the loop in my code to run indefinitely.
In case of IsTruncated=true
the ContinuationToken
should never be Null/Empty.
Am I missing something or is it a bug on the AWS API?
2
Answers
I’m not sure of your particular issue, but this might help. Many AWS clients in the SDKs contain a paginator to help with paging operations. Have you tried using ListObjectsV2Paginator? This is an example of how it can be used in Go.
You should be looking at
NextContinuationToken
:ContinuationToken
is a copy of what you sent along with the request. If you didn’t send a continuation token, it won’t get returned either.