Skip to content

Bug: There is no sequencer property in S3 LifecycleTransition event #6150

Closed
@DKurilo

Description

@DKurilo

Expected Behaviour

Parsed s3 event when parsing LifecycleTransition event

Current Behaviour

Parsing error. Actually for LifecycleTransition I see many errors.

Code snippet

import json

from aws_lambda_powertools.utilities.parser import parse
from aws_lambda_powertools.utilities.parser.models import S3RecordModel

def main():
    event = '{"eventVersion":"2.3","eventSource":"aws:s3","awsRegion":"us-east-1","eventTime":"2025-02-21T21:46:45.775Z","eventName":"LifecycleTransition","userIdentity":{"principalId":"s3.amazonaws.com"},"requestParameters":{"sourceIPAddress":"s3.amazonaws.com"},"responseElements":{"x-amz-request-id":"something-1","x-amz-id-2":"something-2"},"s3":{"s3SchemaVersion":"1.0","configurationId":"some-sns","bucket":{"name":"bucket-name","ownerIdentity":{"principalId":"PRICIPAL"},"arn":"arn:aws:s3:::bucket-name"},"object":{"key":"/path/to/file.parquet","size":12345,"eTag":"abcdef1232423423","versionId":"SomeThingThere"}},"lifecycleEventData":{"transitionEventData":{"destinationStorageClass":"INTELLIGENT_TIERING"}}}'
    print(str(parse(event=json.loads(event), model=S3RecordModel)))

if __name__ == "__main__":
    main()

Possible Solution

This line
https://github.com/aws-powertools/powertools-lambda-python/blob/develop/aws_lambda_powertools/utilities/parser/models/s3.py#L26
can be:

    sourceIPAddress: Union[IPvAnyNetwork, Literal["s3.amazonaws.com"]]

and this line:
https://github.com/aws-powertools/powertools-lambda-python/blob/develop/aws_lambda_powertools/utilities/parser/models/s3.py#L48

    sequencer: Optional[str] = None

Steps to Reproduce

Copy code snippet and run it.

Powertools for AWS Lambda (Python) version

latest

AWS Lambda function runtime

3.9

Packaging format used

PyPi

Debugging logs

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingparserParser (Pydantic) utility

Type

Projects

Status

Shipped

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions