Using our beloved boto3 library, we are looking for the list of all our Provisioned Products in Service Catalog.
I won't bore you with th code that loops over the result and perform the operation again if we have more than 20 products. But the strange thing, is that wherever we had more than the page size, some products were repeated in the other pages. Thinking of a bug in AWS Service Catalog, we reached out to the Support Team. This is their answer:
This is a known behavior with the SearchProvisionedProducts API when using the default relevance-based sorting. Because results are sorted by relevance, the ordering can shift slightly between paginated requests, which causes duplicates (or occasionally missed items) across pages.
Never heard of relevance-based sorting. Looking at the documentation, there is no mention of it:
The sort field. If no value is specified, the results are not sorted. The valid values are arn, id, name, and lastRecordId.
Then, Support Team is proposing a solution:
Adding SortBy='createdTime' gives the pagination a stable ordering, so the page token points to a consistent boundary between pages. No more duplicates should appear regardless of how many provisioned products you have.
It is interesting to note that 'createdTime' is not listed in the documentation either. We tried it and it works. So a hidden feature solves a known bug.
No comments:
Post a Comment