generated from amazon-archives/__template_MIT-0
-
Couldn't load subscription status.
- Fork 456
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Expected Behaviour
After deleting an object from S3, if a Lambda catches this event, they should be able to parse it. This event name from S3 is ObjectDeleted:*.
Current Behaviour
A ValidationError is thrown because of the missing size and eTag attributes.
Records -> 0 -> s3 -> object -> size
field required (type=value_error.missing)
Records -> 0 -> s3 -> object -> eTag
field required (type=value_error.missing)
The ObjectDeleted event does not include those attributes.
Code snippet
parse(model=S3Model, event=json.loads(s3_message))Payload Example: #1637 (comment)
Possible Solution
Update S3Object so that both size and eTag are optional:
class S3Object(BaseModel):
key: str
size: Optional[NonNegativeFloat]
eTag: Optional[str]
sequencer: str
versionId: Optional[str]Steps to Reproduce
- Create a Lambda function and an S3 bucket
- Trigger the Lambda function through S3 events, and enable the
ObjectDeletedtype - Delete an object from S3
S3Modelwill raise aValidationError
AWS Lambda Powertools for Python version
latest
AWS Lambda function runtime
3.8
Packaging format used
PyPi
Debugging logs
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working