CloudWatchEvents.ScheduledEvent cannot be used with EventBridge Scheduler
- Vorherrschende Sprache
- C#
- Sterne
- 1.7k
- Forks
- 503
- Ø Merge
- 1 T. 18 Std.
- Gemergte PRs (30 T.)
- 21
Beschreibung
### Describe the bug
Attempting to use ScheduledEvent with EventBridge Scheduler fails due to JSON Serialization.
### Regression Issue
- [ ] Select this option if this issue appears to be a regression.
### Expected Behavior
I am able to use ScheduledEvent with EventBridge Scheduler.
### Current Behavior
Error converting the Lambda event JSON payload to type Amazon.Lambda.CloudWatchEvents.ScheduledEvents.ScheduledEvent: The JSON value could not be converted to Amazon.Lambda.CloudWatchEvents.ScheduledEvents.Detail. Path: $.detail | LineNumber: 0 | BytePositionInLine: 339.
### Additional Information/Context
Here's the event I'm receiving:
```json
{
"version": "0",
"id": "49672d39-8c3a-4cc6-8de5-c57b0acf718f",
"detail-type": "Scheduled Event",
"source": "aws.scheduler",
"account": "12345",
"time": "2024-11-07T22:05:00Z",
"region": "eu-central-1",
"resources": [
"arn:aws:scheduler:eu-central-1:12345:schedule/default/test-schedule"
],
"detail": "{}"
}
```
It is very-very similar to what we have in ScheduledEvent. However, "detail" here is a string, not a json object.
According to
https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-events-structure.html
"detail" should be a JSON object, but "{}". I have no idea why such string is allowed, or whether any other stringified JSON is possible there.
### Possible Solution
Write JSON converter, which allows Detail to be string (either allow empty object string only "{}", or a full stringified JSON object - not sure).
### AWS .NET SDK and/or Package version used
Amazon.Lambda.CloudWatchEvents 4.4.0
### Targeted .NET Platform
.NET 8
### Operating System and version
AmazonLinux
Beitragsleitfaden
Rechercherichtung
Beginne mit Amazon.Lambda.CloudWatchEvents.ScheduledEvent und der Deserialisierung von Detail in Version 4.4.0 und vergleiche es anschließend mit der bereitgestellten EventBridge Scheduler-Nutzlast. Bestimme die unterstützte Zeichenfolgenform für detail und überprüfe, dass das Scheduler-Ereignis unter .NET 8 erfolgreich konvertiert wird, ohne die normale Deserialisierung von Ereignisobjekten zu beeinträchtigen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- aws, csharp
- Bereich
- backend, cloud
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100