question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Boto3 delete_objects response does not match documented response

See original GitHub issue

libraries boto3==1.2.4 botocore==1.3.28

Documentation http://boto3.readthedocs.org/en/latest/reference/services/s3.html#S3.Client.delete_objects

Expected Response

{
    'Deleted': [
        {
            'Key': 'string',
            'VersionId': 'string',
            'DeleteMarker': True|False,
            'DeleteMarkerVersionId': 'string'
        },
    ],
    'RequestCharged': 'requester',
    'Errors': [
        {
            'Key': 'string',
            'VersionId': 'string',
            'Code': 'string',
            'Message': 'string'
        },
    ]
}

Response With Quiet Flag False

{
    'Objects': [
        {'Key': '116/bc9/116bc9f8d82411e59885acbc327d2ce5.jpg'}, 
        {'Key': '116/bcf/116bcf90d82411e5991eacbc327d2ce5.jpg'}, 
        {'Key': '116/bd0/116bd092d82411e5b433acbc327d2ce5.jpg'}
    ], 
    'Quiet': False
}
{
    'ResponseMetadata': {
        'RequestId': 'C239536D56004DFB', 
        'HostId': 'AZZ0TNTB0bRTEnc01PNhJyX9ntA0RyiWnRW8VT+sL8z6zkVdag+ni+KXaLJY6BT1', 
        'HTTPStatusCode': 200
    }, 
    'Deleted': [
        {'Key': '116/bcf/116bcf90d82411e5991eacbc327d2ce5.jpg'}, 
        {'Key': '116/bd0/116bd092d82411e5b433acbc327d2ce5.jpg'}, 
        {'Key': '116/bc9/116bc9f8d82411e59885acbc327d2ce5.jpg'}
    ]
}

Response With Quiet Flag True

{
    'Quiet': True, 
    'Objects': [
        {'Key': '116/bc9/116bc9f8d82411e59885acbc327d2ce5.jpg'}, 
        {'Key': '116/bcf/116bcf90d82411e5991eacbc327d2ce5.jpg'}, 
        {'Key': '116/bd0/116bd092d82411e5b433acbc327d2ce5.jpg'}
    ]
}
{
    'ResponseMetadata': {
        'HTTPStatusCode': 200, 
        'RequestId': '2A4C617AC8C2805A', 
        'HostId': 'aU3wrmcKectFxmH9rGUzi0Nati+55lOqlYX1BxyX2KfgUsTXqJkAG10GKTbeXIC3'
    }
}

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
dancostcommented, Feb 14, 2020

It is now 2020 and they still won’t recognize this is a real issue. As it stands, delete_objects method is useless. Since it takes batches of 1000 files as arguments, this would be used to send files to delete in bulk, but because the response does not reflect reality (No confirmation for deletion or errors), the only way for us to know if a file has been deleted from S3, is to look for it in the bucket again. This beats the purpose of using ‘delete_objects’ in the first place.

This is NOT a documentation issue, but a functionality issue. But the least you could do is update the docs, to let potential users know this feature is broken, or remove it entirely from the docs, before other people invest more time trying to implement something that just.doesn’t.work.

5reactions
hexvoltcommented, Apr 1, 2019

2019, still there, cmon guys

It returns wrong data, it’s not just a “nice to have” thing. And this is not just a documentation (please remove the api-documentation label), this is a bug. There is no point in returning data duplicated from the request, regardless of actual operations performed in S3.

The workaround for this bug is bombarding S3 with requests deleting all files one by one - that’s not the way. Could you assign a Bug label and bring it forward pls?

Read more comments on GitHub >

github_iconTop Results From Across the Web

S3 — Boto3 Docs 1.26.34 documentation - AWS
After Amazon S3 begins processing the request, it sends an HTTP response header that specifies a 200 OK response. While processing is in...
Read more >
DeleteObjects - Amazon Simple Storage Service
This example illustrates a Multi-Object Delete request to delete objects that result in mixed success and errors response. The following request deletes two ......
Read more >
how to delete files from amazon s3 bucket? - Stack Overflow
Welcome to 2020 here is the answer in Python/Django: from django.conf import settings import boto3 s3 = boto3.client('s3') s3.delete_object(Bucket=settings.
Read more >
Dell EMC PowerScale: OneFS S3 API Guide
prefix. Yes. This limits the response to keys that begin with the specified prefix. x-amz-request-payer. No. N/A. 2.9. ListObjectsV2.
Read more >
Boto3 Documentation - Read the Docs
If it was a 404 error, then the bucket does not exist. error_code = int(e.response['Error']['Code']) if error_code == 404: exists = False.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found