aws / aws/aws-lambda-java-libs
Scheduled Event (V2) contains non-object detail parameter (it is a string)
- Ngôn ngữ chính
- Java
- Star
- 548
- Fork
- 241
- Merge trung bình
- 2 ngày 5 phút
- Pull request đã merge (30 ngày)
- 11
Mô tả
When I'm using ScheduledEvent as a source event in the lambda handler where actually Amazon EventBridge Scheduler's Schedule is a trigger for the function, I'm getting
```
An error occurred during JSON parsing: java.lang.RuntimeException
java.lang.RuntimeException: An error occurred during JSON parsing
Caused by: java.io.UncheckedIOException: com.amazonaws.lambda.thirdparty.com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `java.util.LinkedHashMap` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('
{}
')
at [Source: (ByteArrayInputStream); line: 1, column: 318] (through reference chain: com.amazonaws.services.lambda.runtime.events.ScheduledEvent["detail"])
at com.amazonaws.services.lambda.runtime.serialization.factories.JacksonFactory$InternalSerializer.fromJson(JacksonFactory.java:199)
Caused by: com.amazonaws.lambda.thirdparty.com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `java.util.LinkedHashMap` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('
{}
')
```
because "detail" parameter in that event is not an object - it is a string. Look at this sample below from Java logger:
```
Event: {
"version": "0",
"id": "4e6638b7-b892-4482-9762-8c58d4e71ebb",
"detail-type": "Scheduled Event",
"source": "aws.scheduler",
"account": "xxx",
"time": "2024-05-06T10:58:00Z",
"region": "eu-west-1",
"resources": [
"arn:aws:scheduler:eu-west-1:xxx:schedule/default/xxx"
],
"detail": "{}"
}
```
IMO AWS should fix this event source for sending object-compatible field or we should implement new class e.g. `ScheduledV2Event` with a `String` type, not a Map. It looks like the "old" Scheduled Event is not compatible with the new Scheduled V2 Event.
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu với model ScheduledEvent và đường dẫn giải tuần tự hóa của JacksonFactory được nêu trong stack trace, sau đó so sánh chúng với payload EventBridge Scheduler được hiển thị. Hoàn thành khi detail dạng chuỗi của scheduled event V2 có thể được biểu diễn và giải tuần tự hóa mà không gặp MismatchedInputException đã báo cáo, đồng thời hành vi tương thích được chọn được kiểm thử.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- aws, java
- Lĩnh vực
- backend
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100