-
Notifications
You must be signed in to change notification settings - Fork 436
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
ObjectDeleted
type - Delete an object from S3
S3Model
will 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