This repository was archived by the owner on Mar 23, 2026. It is now read-only.
Added test and fix for wrong time format and serialization in events v2#11959
Merged
Added test and fix for wrong time format and serialization in events v2#11959
Conversation
LocalStack Community integration with Pro 2 files ± 0 2 suites ±0 1h 7m 50s ⏱️ - 41m 6s Results for commit 5610d08. ± Comparison against base commit 892eb4d. This pull request removes 1541 and adds 3 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
maxhoheiser
approved these changes
Nov 29, 2024
Contributor
maxhoheiser
left a comment
There was a problem hiding this comment.
LGTMT - nice implementation - I belive we had a custom json encoder at one point for serialization
maxhoheiser
reviewed
Nov 29, 2024
|
|
||
| EventSourceList = List[EventSource] | ||
| EventTime = datetime | ||
| EventTime = Union[datetime, str] |
Contributor
There was a problem hiding this comment.
maybe use the newer recommended way datetime | str
maxhoheiser
reviewed
Nov 29, 2024
| return event_time | ||
|
|
||
|
|
||
| def format_event_time(event_time: datetime) -> str: |
Contributor
There was a problem hiding this comment.
why would we need the same function 2 times? just use event_time_to_time_string ?
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Found through an issue: #11630
When using EventBridge v2, events containing datetime fields fail to be delivered due to JSON serialization error:
Object of type datetime is not JSON serializable. This affects events with explicit Time fields as well as automatically generated timestamps.Changes
format_event_timefunction to properly format datetime objects to ISO8601 stringsformat_eventto use the formatted time stringThe fix ensures proper datetime handling in events while maintaining AWS parity by formatting all time values to ISO8601 strings (YYYY-MM-DDThh:mm:ssZ).