S3 Event Bridge events have null values for VersionId. Is this a bug?

0

When working with Lambda Functions to handle EventBridge events from an S3 bucket with versioning enabled, I find that the VersionId field of the AWS Event object always shows a null value instead of the true value.

For example, here is the JSON AWSEvent that uses the aws.s3@ObjectDeleted schema. This JSON was the event payload that went to my Lambda Function when I deleted an object from a bucket that had versioning enabled: Note that $.object.versionId is null but when I look in the bucket, I see unique Version ID values for both the original cat pic "BeardCat.jpg" and its delete marker. Also, I found the same problem in the AWSEvent JSON for an aws.s3@ObjectCreated event, too. There should have been a non-null VersionId in the ObjectCreated event and the ObjectDeleted event.

Have I found a bug?

Note: Where you see 'xxxx' or 'XXXXXXXXX' I was simply redacting AWS Account numbers and S3 bucket names for privacy reasons.

{
    detail: class ObjectDeleted {
        bucket: class Bucket {
            name: tails-dev-images-xxxx
        }
        object: class Object {
            etag: d41d8cd98f00b204e9800998ecf8427e
            key: BeardCat.jpg
            sequencer: 0061CDD784B140A4CB
            versionId: null
        }
        deletionType: null
        reason: DeleteObject
        requestId: null
        requester: XXXXXXXXX
        sourceIpAddress: null
        version: 0
    }
    detailType: null
    resources: [arn:aws:s3:::tails-dev-images-xxxx]
    id: 82b7602e-a2fe-cffb-67c8-73b4c8753f5f
    source: aws.s3
    time: Thu Dec 30 16:00:04 UTC 2021
    region: us-east-2
    version: 0
    account: XXXXXXXXXX
}
2개 답변
0

Hi! Good question.

This is most likely caused by how enabling versioning on objects and deletion works. When versioning is enabled, a simple DELETE call does not permanently delete the object. Instead, S3 inserts a delete marker and the marker becomes the current version of the object with a new ID.

When trying to GET an object whose current version is a delete marker, Amazon S3 will behave as though the object has been deleted (even though it has not been erased) and returns a 404 error.

References:

jsonc
답변함 2년 전
  • Yes, but all objects and all delete markers in an S3 bucket with versioning enabled actually have version ids. And, if I don't use EventBridge and I just use the regular Event Notification stuff in S3, the S3Event objects that are sent to Lambda, SNS and SQS always include the VersionId in new objects and deleted objects.

    I'm still holding out for another answer because the events and their payloads should have the same data especially when the Schema for the aws.s3@ObjectDeleted and aws.s3@ObjectCreated in EventBridge have a field for versionId.

    TheSpunicorn

0

Some more info re: the Schema aws.s3@ObjectDeleted. It appears that in the Schema definition, the versionId field is actually called 'version-id'. Maybe there is a disconnect here due to the difference in spelling between 'versionId' and 'version-id'.

Here is the relevant excerpt from the aws.s3@ObjectDeleted schema.

"Object": {
        "type": "object",
        "required": ["etag", "key", "sequencer"],
        "properties": {
          "etag": {
            "type": "string"
          },
          "key": {
            "type": "string"
          },
          "sequencer": {
            "type": "string"
          },
          "version-id": {
            "type": "string"
          }
        }
답변함 2년 전

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

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

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

관련 콘텐츠