Skip to content

Conversation

@yaythomas
Copy link
Member

@yaythomas yaythomas commented Feb 6, 2026

Description of changes:
SQLite storage was failing with "Object of type datetime is not JSON serializable" when attempting to save execution state after Lambda invocation. The root cause was InvocationCompletedDetails.to_dict() returning raw datetime objects instead of JSON-serializable integers.

This fix adds to_json_dict() and from_json_dict() methods to InvocationCompletedDetails that convert datetime objects to/from Unix milliseconds using TimestampConverter, matching the pattern already used by the SDK's Operation class.

This fix the breakage in sam cli.

Error:    DurableFunctionsTestError: Unexpected error during Lambda invocation: None is not a valid InvocationStatus
which is caused by:
...
Error:  ExecutionError: Unexpected payload provided to start the durable execution. Check your resource configurations to confirm the durability is set.
Traceback (most recent call last):
  File "/var/task/aws_durable_execution_sdk_python/execution.py", line 269, in wrapper
    raise ExecutionError(msg) from e

Changes:

  • Add InvocationCompletedDetails.to_json_dict() for serialization
  • Add InvocationCompletedDetails.from_json_dict() for deserialization
  • Update Execution.to_json_dict() to call completion.to_json_dict()
  • Update Execution.from_json_dict() to call from_json_dict()

The to_dict() method is preserved for internal use where datetime objects are needed, while to_json_dict() is used for storage and JSON serialization paths.

Fixes execution persistence failures in SQLite and filesystem stores.

Issue #, if available:
closes #193

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@bchampp
Copy link
Member

bchampp commented Feb 6, 2026

🤖 Emulator PR Created

A draft PR has been created with locked dependencies:

➡️ https://github.com/aws/aws-durable-execution-emulator/pull/324

The emulator will build binaries using the exact testing SDK commit locked in uv.lock.

@yaythomas yaythomas force-pushed the invocation-completed-datetime branch from d9930ee to 0cdc2a2 Compare February 6, 2026 11:56
@bchampp
Copy link
Member

bchampp commented Feb 6, 2026

🔄 Emulator PR Updated

The emulator PR has been updated with locked dependencies:

➡️ https://github.com/aws/aws-durable-execution-emulator/pull/324

SQLite storage was failing with "Object of type datetime is not JSON
serializable" when attempting to save execution state after Lambda
invocation. The root cause was InvocationCompletedDetails.to_dict()
returning raw datetime objects instead of JSON-serializable integers.

This fix adds to_json_dict() and from_json_dict() methods to
InvocationCompletedDetails that convert datetime objects to/from Unix
milliseconds using TimestampConverter, matching the pattern already
used by the SDK's Operation class.

Changes:
- Add InvocationCompletedDetails.to_json_dict() for serialization
- Add InvocationCompletedDetails.from_json_dict() for deserialization
- Update Execution.to_json_dict() to call completion.to_json_dict()
- Update Execution.from_json_dict() to call from_json_dict()

The to_dict() method is preserved for internal use where datetime
objects are needed, while to_json_dict() is used for storage and
JSON serialization paths.

Fixes execution persistence failures in SQLite and filesystem stores.

closes #193
@yaythomas yaythomas force-pushed the invocation-completed-datetime branch from 0cdc2a2 to 91c3bf6 Compare February 6, 2026 17:16
@bchampp
Copy link
Member

bchampp commented Feb 6, 2026

🔄 Emulator PR Updated

The emulator PR has been updated with locked dependencies:

➡️ https://github.com/aws/aws-durable-execution-emulator/pull/324

@yaythomas yaythomas merged commit f9caf24 into main Feb 6, 2026
59 checks passed
@yaythomas yaythomas deleted the invocation-completed-datetime branch February 6, 2026 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: datetime serialization for InvocationCompletedDetails breaks sam-cli

2 participants