S3 DeleteObjects API call reports that it successfully deleted an object that never existed

0

I'm working on an app that should remove unused S3 objects. Testing the DeleteObjects API using ruby aws-sdk-s3 (1.143.0) I ran into an issue: sometimes the response reported that it successfully deleted objects that never existed.

Here is an example:

s3_client.delete_objects(
  bucket: 'my_bucket',
  delete: {
    objects: [
      { key: "kd13/639d/02a1/6000/7e37/0000/0000/fruits_1/banana1", version_id: "2065a469-38cb-4227-a068-5ec63c0a8b81"},
      { key: "kd13/639d/02a1/6000/7e37/0000/0000/fruits_2/banana2", version_id: "7d276a26-d33f-4888-8498-6819c642c1e9"},
      { key: "kd13/639d/02a1/6000/7e37/0000/0000/fruits_3/banana3", version_id: "5fa399d7-c852-4409-8cda-0343ed539b46"},
      { key: "kd13/639d/02a1/b8ea/6024/575a/d912/file5", version_id: "nmsWTEhkoaGM6nInyGGMjfa_FmS1Yop0"},
      { key: "kd13/639d/02a1/b8ea/6024/575a/d912/file5", version_id: "twcIET1.wRN1pFg_aa4mn5O2RtS2Bap7"},
    ]
  }
) 

Response:

  #<struct Aws::S3::Types::DeleteObjectsOutput
    deleted=[
        #<struct Aws::S3::Types::DeletedObject key="kd13/639d/02a1/b8ea/6024/575a/d912/file1", version_id="nmsWTEhkoaGM6nInyGGMjfa_FmS1Yop0", delete_marker=nil, delete_marker_version_id=nil>,
        #<struct Aws::S3::Types::DeletedObject key="kd13/639d/02a1/6000/7e37/0000/0000/fruits_3/banana3", version_id="5fa399d7-c852-4409-8cda-0343ed539b46", delete_marker=nil, delete_marker_version_id=nil>,
        #<struct Aws::S3::Types::DeletedObject key="kd13/639d/02a1/b8ea/6024/575a/d912/file5", version_id="twcIET1.wRN1pFg_aa4mn5O2RtS2Bap7", delete_marker=nil, delete_marker_version_id=nil>
    ],
    request_charged=nil,
    errors=[
        #<struct Aws::S3::Types::Error key="kd13/639d/02a1/6000/7e37/0000/0000/fruits_1/banana1", version_id="2065a469-38cb-4227-a068-5ec63c0a8b81", code="NoSuchVersion", message="The specified version does not exist.">,
        #<struct Aws::S3::Types::Error key="kd13/639d/02a1/6000/7e37/0000/0000/fruits_2/banana2", version_id="7d276a26-d33f-4888-8498-6819c642c1e9", code="NoSuchVersion", message="The specified version does not exist.">
    ]>

My request contained a mix of real keys/version_ids and some fake ones to test how we handle errors. Objects that have prefix kd13/639d/02a1/6000/7e37/0000/0000/fruits have never existed in S3, they even have their version ids in the illegal format. As you can see, kd13/639d/02a1/6000/7e37/0000/0000/fruits_3/banana3 was reported as successfully deleted when the others were reported as not found.

Another problem is that later API calls (it's been more than an hour after the first API call) with the same input kept returning the same result, even though the real objects had been deleted earlier and I confirmed this. I'd expect getting NoSuchVersion for all the objects in the consecutive requests.

Is this an expected behavior?

Thank you.

KD
질문됨 2달 전208회 조회
1개 답변
0

Good day,

To answer your question, we require details that are non-public information. Please open a support case with AWS using the following link.

Have a great day further.

AWS
지원 엔지니어
답변함 2달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠