Skip to content

Pagination error same continuation token returned on last page #30337

Open
@pierre-at-work

Description

  • azure-cosmos:
  • 4.3.0:
  • debian:11:
  • 3.7:

Describe the bug
I use the pager of query_items results and when the pagination reach the last page the continuation token returned is the same as the continuation token provided as parameter to the by_page method. So the code enter in a infinite loop of pagination without returning the continuation token that indicate that the pagination process comes to the end (an empty string). The query used is something like that: SELECT * FROM r WHERE r.type='foo' ORDER BY bar ASC

To Reproduce
I can't reproduce the bug on demand but it appends sometimes
My code looks like something like that

query = " SELECT * FROM r WHERE r.type='foo' ORDER BY bar ASC"

found_items = cosmosdb_container.query_items(
    query, parameters, partition_key=user_id, max_item_count=max_result
)
pager = found_items.by_page(continuation_token)

try:
    items = pager.next()
except StopIteration:
    items = []

Expected behavior
When the pager reach the last page the continuation token returned is an empty string

Additional context
This is a continuation token that is returned as loop in the last page by the package :

+RID:~mNZSAL9hNJvyMWQBAAAABg==#RT:8#TRC:800#RTD:HPJJmKT1uZqlBBnGyNSOBMHZi39F0A==#ISV:2#IEO:65567#QCF:9#FPC:Agh8BQAAABgAAKEFAAAAIAAAfAUAAAAYAAAKAGEAABihGeAAGJB9BQAAABgAAAIAdb1+BQAAABgAAAgAy4Eik8EZ4AB/BQAAABgAAAYAxpqBiEmAgAUAAAAYAAAIACEDAwBxPDAAgQUAAAAYAAAIAMEgAAwakLWNgwUAAAAYAAAKAG2IyYGZgKSL8KiEBQAAABgAAAIA0rSFBQAAABgAAAQAhY4FjYYFAAAAGAAABgBdmzEhgAGHBQAAABgAAAYAxJNxJgBgiQUAAAAYAAAGAPeDESzwAYsFAAAAGAAABgCZjjyboouMBQAAABgAAAgAZIGggsE3gAOOBQAAABgAAAYApIrxEMADkAUAAAAYAAAGAOIxAP4HABAFAAAAIAAAEgABPfz/kUD/4xFA/z/xAQD+MEARBQAAACAAAAoAEUEfALIlAP//ARYFAAAAIAAABgCSHwDA/wAYBQAAACAAABgAkSvAHxmAaIK2gFWAnIURgRWAOYDBBwUAGQUAAAAgAAAIAF6AoR5wAHaOGgUAAAAgAAAOAD+jAcADAHqNPYBBiniBGwUAAAAgAAAKACSJPYBoiliov4McBQAAACAAAAQA8SIGAB0FAAAAIAAABgARDwAGF5EfBQAAACAAAAIAmbggBQAAACAAAAQAgSUAAyEFAAAAIAAABADhIAAHIgUAAAAgAAAKANEMAMD0iOESgAEjBQAAACAAAAQAcRcADiUFAAAAIAAADgAhGfAfQRYAwF+DAcADAC4FAAAAIAAACADSI8D/AwCLki8FAAAAIAAACACslEqAUSoADjAFAAAAIAAABAAdqieFMQUAAAAgAAAKAFECDADhGQA48aEyBQAAACAAAAYA0osbgQqbMwUAAAAgAAAMANiJfoiOg1KEMRYAGDQFAAAAIAAABgC4kbGTgY41BQAAACAAAAoAsQoAcAygw440hjYFAAAAIAAADAArglSAAoAug6uRbYc3BQAAACAAAAQAspbggjgFAAAAIAAABgD+gWExABg5BQAAACAAAAoA14Ptig2khIskgDoFAAAAIAAABgDJgZaJQ4U7BQAAACAAAAQAMQdgADwFAAAAIAAABAAhMTAASgUAAAAgAAACAJ25WAUAAAAgAAAEACEwAAN/BQAAACAAAAQAsSHAB4EFAAAAIAAAAgAisIcFAAAAIAAABABhAwMAiQUAAAAgAAAEALqeDISLBQAAACAAAAQA5o6bk40FAAAAIAAABAChj0yNjgUAAAAgAAACAFyklQUAAAAgAAAEAFEMwAOXBQAAACAAAAIAObuYBQAAACAAAAIACaWZBQAAACAAAAIATpiaBQAAACAAAAIAX5abBQAAACAAAA4Ar4IpmrSIEoUrgWyB4oicBQAAACAAAAwAGJm/nTKAmYDmgYqEngUAAAAgAAACAImEnwUAAAAgAAACAL+ioAUAAAAgAAAEAKEWcAChBQAAACAAAAIAmKU=

Metadata

Assignees

Labels

CosmosService AttentionWorkflow: This issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions