Closed
Description
What were you trying to accomplish?
I was trying to log the received S3 event. Please note that i am using the data classes present in this library for reading the event
@event_source(data_class=S3Event)
@log.inject_lambda_context(
log_event=True
)
def lambda_handler(event: S3Event, context: LambdaContext):
Expected Behavior
The logged event should have all the information from the S3 event
Current Behavior
This is the output i get in the log (trimmed)
{
"level": "INFO",
"message": "<aws_lambda_powertools.utilities.data_classes.s3_event.S3Event object at 0x7f0be7efb2b0>",
"timestamp": "2022-01-11 06:36:20,111+0000",
}
It looks to be that it was unable to properly represent the S3Event object as a string
Possible Solution
Implement repr and str methods in S3Event class or in the parent DictWrapper class
Steps to Reproduce (for bugs)
- Implement a lambda which receives and S3 event like the following
@event_source(data_class=S3Event)
@log.inject_lambda_context(
log_event=True
)
def lambda_handler(event: S3Event, context: LambdaContext):
pass
- Setup the lambda trigger as S3 object creation event
- Upload a file in the S3 bucket where trigger is setup
- See the logs in cloud watch
Environment
- Powertools version used: 1.24.0
- Packaging format (Layers, PyPi): PyPi
- AWS Lambda function runtime: 3.9
- Debugging logs
# paste logs here