8000 Bug: S3EventBridgeNotificationObject dataclass cannot return version_id · Issue #6740 · aws-powertools/powertools-lambda-python · GitHub
[go: up one dir, main page]

Skip to content
Bug: S3EventBridgeNotificationObject dataclass cannot return version_id #6740
Closed
@gwilson185

Description

@gwilson185

Expected Behaviour

In the class S3EventBridgeNotificationObject located in aws_lambda_powertools.utilities.data_classes.s3_event.py the property "version_id" should return self["version_id"]

Current Behaviour

In the class S3EventBridgeNotificationObject located in aws_lambda_powertools.utilities.data_classes.s3_event.py the property "version_id" IS returning self["version-id"] , which does not exist

Code snippet

**Example EB Event from S3:** 
`{'account': '1111111111', 'detail': {'bucket': {'name': 'bucket-name', 'raw_event': '[SENSITIVE]'}, 'deletion_type': None, 'destination_access_tier': None, 'destination_storage_class': None, 'object': {'etag': '145bba459f6e8ffd091a05c9ae703693', 'key': 'object-key', 'raw_event': '[SENSITIVE]', 'sequencer': '0068385E251A75725B', 'size': 1167240, 'version_id': '[Cannot be deserialized]'}, 'raw_event': '[SENSITIVE]', 'reason': 'PutObject', 'request_id': '2X0DAA9HWH8M26PB', 'requester': '11111111111', 'restore_expiry_time': None, 'source_ip_address': '########', 'source_storage_class': None, 'version': '0'}, 'detail_type': 'Object Created', 'get_id': 'b7c6d31d-677d-b716-7604-ca913407ed14', 'raw_event': '[SENSITIVE]', 'region': '#########', 'replay_name': '[Cannot be deserialized]', 'resources': ['arn:aws:s3:::bucket-name'], 'source': 'aws.s3', 'time': 'datetimestampZ', 'version': '0'}`

Possible Solution

Change line 52 in aws_lambda_powertools.utilities.data_classes.s3_event.py to return self["version_id"]

Steps to Reproduce

Pass an EventBridge S3 Object Event formatted dict to the S3EventBridgeObjectNotifcationEvent class and then try to reference event.detail.object.version_id.

Powertools for AWS Lambda (Python) version

latest

AWS Lambda function runtime

3.12

Packaging format used

PyPi

Debugging logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriagePending triage from maintainers

    Type

    No type

    Projects

    Status

    Coming soon

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0