Expected Behaviour
When logging handler events or attempting to extract the correlation ID from an event such as ScheduledEvent, I expect that the event gets serialized to a valid JSON when logging and that the correlation ID extraction is working as expected.
Current Behaviour
For AWS events that use Joda time under the hood, for example ScheduledEvent, we see the following exception:
Joda date/time type `org.joda.time.DateTime` not supported by default: add Module "com.fasterxml.jackson.datatype:jackson-datatype-joda" to enable handling (through reference chain: com.amazonaws.services.lambda.runtime.events.ScheduledEvent["time"]): java.lang.IllegalArgumentException
java.lang.IllegalArgumentException: Joda date/time type `org.joda.time.DateTime` not supported by default: add Module "com.fasterxml.jackson.datatype:jackson-datatype-joda" to enable handling (through reference chain:
The correlation ID is not extracted at all. The event logging falls back to calling toString() on the event. In case of the ScheduledEvent this yields an invalid json due to a non-JSON compliant implementation in the AWS event library.
Example:
{
"level": "INFO",
"message": "Handler Event",
"cold_start": true,
"thread": "main",
"function_arn": "arn:aws:lambda:us-east-1:<ACCOUNT_ID>:function:powertools-examples-batch-sq-DemoSQSSenderFunction-kGvQ7guWRsW0",
"function_memory_size": 5400,
"function_name": "powertools-examples-batch-sq-DemoSQSSenderFunction-kGvQ7guWRsW0",
"function_request_id": "d780b6fc-d30a-497c-a75c-400bea718983",
"function_version": "$LATEST",
"service": "sqs-batch-demo",
"timestamp": "2025-10-31T09:57:33.526Z",
"xray_trace_id": "1-6904880a-3b7f5d6d0dc62d10320adf78",
"event": "{version: 0,account: <ACCOUNT_ID>,region: us-east-1,detail: {correlationId=d9279e79-3303-4e2b-8f45-f012e492995c},detailType: Scheduled Event,source: aws.events,id: 9e674628-1dbf-7389-4698-4716a8508c3e,time: 2025-10-31T09:57:20.000Z,resources: [arn:aws:events:us-east-1:320554615336:rule/powertools-examples-batch-sqs-ScheduleRule-Lt929sdEpb9q]}"
}
Code snippet
Powertools batch example. SqsBatchSender.java
Possible Solution
We should add Joda time to powertools-serialization.
Steps to Reproduce
Add event logging in SqsBatchSender.java and attempt to extract a correlation ID from the event.
Powertools for AWS Lambda (Java) version
latest
AWS Lambda function runtime
Java 21
Debugging logs
Expected Behaviour
When logging handler events or attempting to extract the correlation ID from an event such as
ScheduledEvent, I expect that the event gets serialized to a valid JSON when logging and that the correlation ID extraction is working as expected.Current Behaviour
For AWS events that use
Jodatime under the hood, for exampleScheduledEvent, we see the following exception:The correlation ID is not extracted at all. The event logging falls back to calling
toString()on the event. In case of theScheduledEventthis yields an invalid json due to a non-JSON compliant implementation in the AWS event library.Example:
Code snippet
Possible Solution
We should add Joda time to
powertools-serialization.Steps to Reproduce
Add event logging in
SqsBatchSender.javaand attempt to extract a correlation ID from the event.Powertools for AWS Lambda (Java) version
latest
AWS Lambda function runtime
Java 21
Debugging logs