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
ObjectDeleted type
- Delete an object from S3
S3Model will raise a ValidationError
AWS Lambda Powertools for Python version
latest
AWS Lambda function runtime
3.8
Packaging format used
PyPi
Debugging logs
No response
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
ValidationErroris thrown because of the missingsizeandeTagattributes.The
ObjectDeletedevent does not include those attributes.Code snippet
Payload Example: #1637 (comment)
Possible Solution
Update
S3Objectso that bothsizeandeTagare optional:Steps to Reproduce
ObjectDeletedtypeS3Modelwill raise aValidationErrorAWS Lambda Powertools for Python version
latest
AWS Lambda function runtime
3.8
Packaging format used
PyPi
Debugging logs
No response