Jenny Mok
Jenny Mok

Reputation: 2804

s3 deleteObj success return empty object

s3Bucket.deleteObject({
                Bucket: 'assets.memori.my',
                Key: key
                }, function(err,data){
                  console.log(data);
                  res.end();
  })

I checked my file did got deleted but what I get in data is an {}, where does the success callback come?

Upvotes: 1

Views: 551

Answers (1)

ketan vijayvargiya
ketan vijayvargiya

Reputation: 5659

That is expected.

Per the documentation, data can contain the following params:

  • DeleteMarker
  • VersionId
  • RequestCharged

The first two are relevant only for versioned objects, the 3rd only if the requester doesn't own the bucket. It looks like none of these cases are applicable to you.

How do you know if your request was successful? Per the documentation, your request was successful if err is null. For failed requests, data would be null.

err (Error) — the error object returned from the request. Set to null if the request is successful. data (Object) — Set to null if a request error occurs.

Upvotes: 1

Related Questions