[Bugfix] Batch delete objects in chunks of 1000 elements when calling delete_objects boto3 s3 api#179
Merged
joakimen merged 1 commit intocapralifecycle:masterfrom Dec 9, 2025
Conversation
joakimen
approved these changes
Dec 9, 2025
Contributor
|
🎉 This PR is included in version 2.5.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Todays version of webapp deploy does not support cases when more than 1000 files is scheduled for deletion.
Having more than 1000 files in the objects-list for cleanup, the current error is thrown:
This is due to a limit in the boto3 s3 api, where delete_objects only support a list of 1000 objects [1].
This pull request reduces the number of objects per delete_objects-call, into chunks of 1000 elements per call. This way, the construct supports SPA applications where there might be over 1000 assets to be deleted.
[1] Url fetched at 8th December 2025 20:38 Europe/Oslo: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3/client/delete_objects.html
Text: