Skip to content

Bug: S3 SQS Event Parsing for LifecycleExpiration:Delete is failed #5129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DKurilo opened this issue Sep 5, 2024 · 7 comments · Fixed by #5250
Closed

Bug: S3 SQS Event Parsing for LifecycleExpiration:Delete is failed #5129

DKurilo opened this issue Sep 5, 2024 · 7 comments · Fixed by #5250
Assignees
Labels
bug Something isn't working

Comments

@DKurilo
Copy link
Contributor

DKurilo commented Sep 5, 2024

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

@DKurilo DKurilo added bug Something isn't working triage Pending triage from maintainers labels Sep 5, 2024
Copy link

boring-cyborg bot commented 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

@DKurilo DKurilo changed the title Bug: S3 SQS Evnet Parsing for LifecycleExpiration:Delete is failedd Bug: S3 SQS Evnet Parsing for LifecycleExpiration:Delete is failed Sep 5, 2024
@leandrodamascena
Copy link
Contributor

Hi @DKurilo! Thanks for opening this issue! I'll take a look at it until tomorrow.

@leandrodamascena leandrodamascena self-assigned this Sep 9, 2024
@leandrodamascena leandrodamascena removed the triage Pending triage from maintainers label Sep 9, 2024
@leandrodamascena leandrodamascena moved this from Triage to Pending review in Powertools for AWS Lambda (Python) Sep 9, 2024
@DKurilo DKurilo changed the title Bug: S3 SQS Evnet Parsing for LifecycleExpiration:Delete is failed Bug: S3 SQS Event Parsing for LifecycleExpiration:Delete is failed Sep 9, 2024
@leandrodamascena
Copy link
Contributor

Hi @am29d! As we discussed yesterday, I'm assigning this issue to you.

@leandrodamascena
Copy link
Contributor

Assigning to me.

Copy link
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

This issue is now closed. Please be mindful that future comments are hard for our team to see.

If you need more assistance, please either tag a team member or open a new issue that references this one.

If you wish to keep having a conversation with other community members under this issue feel free to do so.

@github-actions github-actions bot added the pending-release Fix or implementation already in dev waiting to be released label Sep 26, 2024
Copy link
Contributor

github-actions bot commented Oct 8, 2024

This is now released under 3.1.0 version!

@github-actions github-actions bot removed the pending-release Fix or implementation already in dev waiting to be released label Oct 8, 2024
@DKurilo
Copy link
Contributor Author

DKurilo commented Oct 17, 2024

Thank you!

@leandrodamascena leandrodamascena moved this from Coming soon to Shipped in Powertools for AWS Lambda (Python) Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Shipped
3 participants