From d5c9df05ad613159f74bd657aa933508b6da6a25 Mon Sep 17 00:00:00 2001 From: Bill Freeman Date: Tue, 7 Jul 2026 17:55:57 -0500 Subject: [PATCH] Fix EventbridgeClient: send PutEvents Time as a Date, not an ISO string formatEventInput normalized an event's `time` to an ISO string (compose(toIso, fromIsoUtc)) and handed it to PutEventsCommand. Under aws-sdk v3 that throws "SerializationException: STRING_VALUE can not be converted to milliseconds since epoch"; v2 tolerated the string. Wrap the normalized value in a Date so the SDK marshals it correctly. Co-Authored-By: Claude Opus 4.8 (1M context) --- CHANGELOG.md | 9 +++++++++ lib/clients/eventbridge.js | 3 ++- lib/clients/eventbridge.spec.js | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8569a8b..96a810c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/) and this project adheres to [Semantic Versioning](https://semver.org/). +## 3.0.3 + +### Fixed + +- `EventbridgeClient.putEvents`: send the entry `Time` as a `Date` rather than an + ISO string. Under AWS SDK v3, `PutEventsCommand` rejects a string timestamp + with `SerializationException: STRING_VALUE can not be converted to milliseconds + since epoch`, so any event carrying a `time` failed since the v3 upgrade. + ## 3.0.0 ### Changed diff --git a/lib/clients/eventbridge.js b/lib/clients/eventbridge.js index 3a5ab5b..e56b919 100644 --- a/lib/clients/eventbridge.js +++ b/lib/clients/eventbridge.js @@ -110,7 +110,8 @@ const formatEventInput = (eventBusName) => filter(reject(isNil)), evolve({ detail: toJson, - time: compose(toIso, fromIsoUtc) + // SDK v3 PutEvents needs a real Date; an ISO string throws SerializationException. + time: compose((iso) => new Date(iso), toIso, fromIsoUtc) }), keysToPascalCase ) diff --git a/lib/clients/eventbridge.spec.js b/lib/clients/eventbridge.spec.js index 5dbd69e..58073d3 100644 --- a/lib/clients/eventbridge.spec.js +++ b/lib/clients/eventbridge.spec.js @@ -142,7 +142,7 @@ const eventInput = [ ] const eventEntry = { - Time: '2020-01-01T00:00:00.000Z', + Time: new Date('2020-01-01T00:00:00.000Z'), Source: 'mock-source', Resources: ['mock-resource'], DetailType: 'mock-detail-type',