Aws-sdk-js: Successful s3.deleteObject call returns empty results

Created on 24 Oct 2016  Â·  6Comments  Â·  Source: aws/aws-sdk-js

Using aws-sdk 2.6.9. When I execute a successful deletion request:

s3.deleteObject({
  Bucket: 'my-bucket',
  Key: 'some/key/file.txt',
}, (error, result) => {
  console.log(error, result);
});

error is null and result is {}. I'm pretty sure this is unexpected behavior.

guidance

Most helpful comment

Good to know - thanks for clarifying!

All 6 comments

No it isn't.

From http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectDELETE.html

This implementation of the operation does not return response elements.

Then what about this?

http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#deleteObject-property

Quote:

Parameters:

  • err (Error) — the error object returned from the request. Set to null if the request is successful.
  • data (Object) — the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

    • DeleteMarker — (Boolean) Specifies whether the versioned object that was permanently deleted was (true) or was not (false) a delete marker.

    • VersionId — (String) Returns the version ID of the delete marker created as a result of the DELETE operation.

    • RequestCharged — (String) If present, indicates that the requester was successfully charged for the request. Possible values include:

      "requester"


That seems to only apply to DELETEs in versioned buckets.

@ffxsam
@monken is correct, those fields on the data object are not guaranteed to be there. DeleteMarker and VersionID should be there when working with versioned objects, and RequestCharged should be there is the object is configured such that requesters get charged for downloads.

Good to know - thanks for clarifying!

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

Was this page helpful?
0 / 5 - 0 ratings