Closed
Description
Expected Behaviour
LifecycleExpiration:Delete
events for SQS queue should be parsed properly
Current Behaviour
Error because for all :Delete
events size
and eTag
are not in event and code here is requires it:
https://github.com/aws-powertools/powertools-lambda-python/blob/develop/aws_lambda_powertools/utilities/parser/models/s3.py#L108
I added code from link to code snippet
Code snippet
@root_validator(allow_reuse=True, skip_on_failure=True)
def validate_s3_object(cls, values):
event_name = values.get("eventName")
s3_object = values.get("s3").object
if "ObjectRemoved" not in event_name:
if s3_object.size is None or s3_object.eTag is None:
raise ValueError("S3Object.size and S3Object.eTag are required for non-ObjectRemoved events")
return values
Possible Solution
Change condition from:
if "ObjectRemoved" not in event_name:
to
if ":Delete" not in event_name:
Steps to Reproduce
Try to parse LifecycleExpiration:Delete
.
Powertools for AWS Lambda (Python) version
latest
AWS Lambda function runtime
3.8
Packaging format used
Lambda Layers
Debugging logs
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Shipped
Activity
boring-cyborg commentedon Sep 5, 2024
Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link
[-]Bug: S3 SQS Evnet Parsing for LifecycleExpiration:Delete is failedd[/-][+]Bug: S3 SQS Evnet Parsing for LifecycleExpiration:Delete is failed[/+]leandrodamascena commentedon Sep 9, 2024
Hi @DKurilo! Thanks for opening this issue! I'll take a look at it until tomorrow.
[-]Bug: S3 SQS Evnet Parsing for LifecycleExpiration:Delete is failed[/-][+]Bug: S3 SQS Event Parsing for LifecycleExpiration:Delete is failed[/+]leandrodamascena commentedon Sep 10, 2024
Hi @am29d! As we discussed yesterday, I'm assigning this issue to you.
14 remaining items