Cannot deserialize value of type `java.lang.String` from Object value
Maintainer thường phản hồi trong vòng 1 ngày
@mbfreder đang làm issue này rồi.
Từ ngày 24/4/2024.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
To help us debug your issue fill in the basic information below using the options provided
Serverless Java Container version: 2.0.1
Implementations: Spring Boot
Framework version: SpringBoot 3.2.4
Frontend service: REST API
Deployment method: Serverless Framework
Scenario
Describe what you are trying to accomplish
Hello I am creating a lambda function for my service. when I try to call my post API with the json body from lambda test console it is not able to deserialize it into the object which is defined in my code
Expected behavior
Describe how you would expect the application to behave
When I pass the body as json input it should get deserialized and consumed in my spring boot application
Actual behavior
Describe what you are seeing instead
It is throwing java.lang.String from Object value
Steps to reproduce
*Provide code samples we can use to reproduce the issue as part of our integration tests. If there is a public repository for the misbehaving application link to it here
Below is the test input given
{
"resource": "/{proxy+}",
"path": "/api/v1/inference",
"body": {
"model":"sketch",
"sketch":{
"params": {
"seed": 12345,
"max_seq_length": 512,
"temperature": 1.0,
"top_k": 1.0,
"top_p": 0.5
},
"sketch": {
"version": "4.0.0",
"metadata": {
"parent_project": "simple_11f5627d",
"document_name": "Untitled",
"component_name": "Untitled",
"component_hierarchy": []
},
"name": "Test1",
"type": "Sketch"
}
}
},
"headers": {
"Authorization": "Bearer <Removed Token>"
},
"httpMethod": "POST",
"requestContext": {
<Removed this since its not necessary for the issue>
}
}
StreamLambdaHandler
public class StreamLambdaHandler implements RequestStreamHandler {
private static final Logger logger = LoggerFactory.getLogger(StreamLambdaHandler.class);
private static final SpringBootLambdaContainerHandler<AwsProxyRequest, AwsProxyResponse> handler;
static {
try {
logger.info("Initializing SpringBootLambdaContainerHandler"+AwsProxyRequest.class);
handler = SpringBootLambdaContainerHandler.getAwsProxyHandler(ServiceApplication.class);
} catch (ContainerInitializationException e) {
e.printStackTrace();
throw new RuntimeException("Could not initialize Spring Boot application", e);
}
}
@Override
public void handleRequest(InputStream inputStream, OutputStream outputStream, Context context)
throws IOException {
logger.info("Handling request"+inputStream.toString());
handler.proxyStream(inputStream, outputStream, context);
}
}
Rest Mapping
@PostMapping("/inference")
public ServiceResponse modelInference(@RequestBody ServiceRequest serviceRequest, @RequestHeader Map<String, String> headers) {
......
Full log output
Paste the full log output from the Lambda function's CloudWatch logs
Below is the stack trace
2024-04-20T09:41:05.847+05:30 at com.amazonaws.services.lambda.runtime.api.client.AWSLambda.startRuntime(AWSLambda.java:197) ~[aws-lambda-java-runtime-interface-client-2.4.2-linux-x86_64.jar:2.4.2]
2024-04-20T09:41:05.847+05:30
at com.amazonaws.services.lambda.runtime.api.client.AWSLambda.main(AWSLambda.java:187) ~[aws-lambda-java-runtime-interface-client-2.4.2-linux-x86_64.jar:2.4.2]
at com.amazonaws.services.lambda.runtime.api.client.AWSLambda.main(AWSLambda.java:187) ~[aws-lambda-java-runtime-interface-client-2.4.2-linux-x86_64.jar:2.4.2]
2024-04-20T09:41:05.848+05:30
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `java.lang.String` from Object value (token `JsonToken.START_OBJECT`)
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `java.lang.String` from Object value (token `JsonToken.START_OBJECT`)
2024-04-20T09:41:05.848+05:30 at [Source: (ByteArrayInputStream); line: 1, column: 59] (through reference chain: com.amazonaws.serverless.proxy.model.AwsProxyRequest["body"])
2024-04-20T09:41:05.848+05:30
at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)
at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)
2024-04-20T09:41:05.848+05:30 at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1752)
2024-04-20T09:41:05.848+05:30 at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1526)
2024-04-20T09:41:05.848+05:30 at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1431)
2024-04-20T09:41:05.848+05:30 at com.fasterxml.jackson.databind.DeserializationContext.extractScalarFromObject(DeserializationContext.java:943)
2024-04-20T09:41:05.848+05:30 at com.fasterxml.jackson.databind.deser.std.StdDeserializer._parseString(StdDeserializer.java:1424)
2024-04-20T09:41:05.848+05:30 at com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:48)
2024-04-20T09:41:05.848+05:30 at com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:11)
2024-04-20T09:41:05.848+05:30 at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
2024-04-20T09:41:05.848+05:30 at com.fasterxml.jackson.module.afterburner.deser.SettableStringMethodProperty.deserializeAndSet(SettableStringMethodProperty.java:41)
2024-04-20T09:41:05.848+05:30 at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:278)
2024-04-20T09:41:05.848+05:30 at com.fasterxml.jackson.module.afterburner.deser.SuperSonicBeanDeserializer.deserialize(SuperSonicBeanDeserializer.java:155)
2024-04-20T09:41:05.848+05:30 at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323)
2024-04-20T09:41:05.848+05:30 at com.fasterxml.jackson.databind.ObjectReader._bindAndClose(ObjectReader.java:2105)
2024-04-20T09:41:05.849+05:30 at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:1481)
2024-04-20T09:41:05.849+05:30 at com.amazonaws.serverless.proxy.internal.LambdaContainerHandler.proxyStream(LambdaContainerHandler.java:257)
2024-04-20T09:41:05.849+05:30 at com.<Removed>.StreamLambdaHandler.handleRequest(StreamLambdaHandler.java:36)
- Ngôn ngữ chính
- Java
- Star
- 1.6k
- Fork
- 575
- Merge trung bình
- 1 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 12
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của aws/serverless-java-container
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
aws/serverless-java-container#1729 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
aws/serverless-java-container#1715 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Support for API Gateway mTLS clientCert fieldCó thể đã có người làm @2748109647 đã nhận 10 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 48/100
aws/serverless-java-container#1726 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
aws/serverless-java-container#1579 · 3 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 42/100
aws/serverless-java-container#1568 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của aws/serverless-java-container
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
ls1intum/thesis-management#1473 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
LunaDeerMC/Dominion#301 · 1 bình luận ·
-
[FEATURE] Expose external refresh, node-level translog and warmer statsCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởuntriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
opensearch-project/opensearch-prometheus-exporter#680 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100