-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
list_shards paginator broken for 1000+ shards #2009
Comments
@slydon - Thank you for your post. I am not able to reproduce the issue. The comment you linked does not say anything about the exact error. Can you please provide me code sample you are using with the exact error you are getting ? This is the documentation on how to use paginator with list_shards api: |
The error is:
The code sample is: import boto3
k = boto3.client('kinesis')
ls_p = k.get_paginator('list_shards')
len([s for p in ls_p.paginate(StreamName='large') for s in p.get('Shards', [])]) How did you try to reproduce this? If you are using kinesalite it doesn't implement this functionality correctly. https://github.com/mhart/kinesalite/blob/master/actions/listShards.js#L12 |
@slydon - Sorry i have directly called the paginator with StartingToken that's why did not able to reproduce the issue. But now i am able to reproduce the issue with the below code: paginator = kinesis.get_paginator("list_shards").paginate(StreamName="test-stream", PaginationConfig={"PageSize": 1})
for page in paginator:
print(page) Marking this as bug. |
I ran into this issue also. Here is a code that can be used until the problem is fixed: def list_shards(kinesis_client, stream_name):
all_shards = []
kwargs = {'StreamName': stream_name}
while True:
resp = kinesis_client.list_shards(**kwargs)
for shard in resp['Shards']:
all_shards.append(shard)
next_token = resp.get('NextToken')
if next_token:
kwargs = {'NextToken': next_token}
else:
break
return {'Shards': all_shards} |
When using the paginator in list_shards for a stream with over 1000 shards an exception is thrown because the list_shards API expects the StreamName to not be set when specifying the NextToken parameter.
This is related to #1462 (comment)
The text was updated successfully, but these errors were encountered: