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',