Description
To help us debug your issue fill in the basic information below using the options provided
Serverless Java Container version: 1.9.3
Implementations: Spring Boot 2
Framework version: SpringBoot 2.7.11
Frontend service: REST API / API Gateway Proxy Request
Deployment method: SAM
Scenario
We have a Java based lambda micro service deployed and we are seeing intermittently missing some(NOT ALL) of the GET request query parameters for some reason. We have a group of query parameters and some of them are randomly missing in random invocation. Majority of the invocations are fine but maybe in a less than 10% invocation we don't see all the query parameters passed into the backend controllers. The incoming requests are coming from the APIGW. We are using Java-11 and aws-serverless-java-container-springboot2(1.9.3). We are following the same pattern described in this page - https://github.com/awslabs/aws-serverless-java-container/wiki/Quick-start---Spring-Boot2
Note: The issue persist with both Single and Multi Value Query Param
Note: This is intermittent issue and not for all the requests.
Expected behavior
The @RestController should get all the query params sent from API Gateway.
Actual behavior
@RestController not receiving all the query param, some of the the query params missing for few requests.
Steps to reproduce
Create Lambda Handler
public class LambdaHandler implements RequestStreamHandler {
private static final SpringBootLambdaContainerHandler<AwsProxyRequest, AwsProxyResponse> handler;
static {
try {
handler = new SpringBootProxyHandlerBuilder<AwsProxyRequest>()
.defaultProxy()
.initializationWrapper(new InitializationWrapper())
.servletApplication()
.springBootApplication(Application.class)
.buildAndInitialize();
} catch (ContainerInitializationException e) {
throw new RuntimeException("Could not initialize Lambda. ", e);
}
}
@Override
public void handleRequest(InputStream inputStream, OutputStream outputStream, Context context) throws IOException {
handler.proxyStream(inputStream, outputStream, context);
}
}
Create @RestController and get the Query Params with @RequestParam Map<String, String> params
{ @GetMapping(path = "/getAll", produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Object> getAll(final @RequestHeader HttpHeaders headers, final @RequestParam Map<String, String> params) { //Log the Query Param to validate. } }
Full log output
Logs to validate Query Param from AwsProxyRequest and we can see the query params reaching Lambda Handler
"multiValueQueryStringParameters": {
"localityName": [
"BLAXLAND"
],
"roadName": [
"WINNICOOPA"
],
"roadNumber1": [
"42"
],
"stateTerritoryCode": [
"NSW"
]
},
"queryStringParameters": {
"localityName": "BLAXLAND",
"roadName": "WINNICOOPA",
"roadNumber1": "42",
"stateTerritoryCode": "NSW"
},
Logs to validate Query Param in @RestController and we can see one of the param missing.
{localityName=[BLAXLAND], stateTerritoryCode=[NSW], roadNumber1=[42]}
Attachment
https://github.com/awslabs/aws-serverless-java-container/assets/94922808/d6bf5164-cf4f-4521-a8c2-964db1a1e9a4
https://github.com/awslabs/aws-serverless-java-container/assets/94922808/8deaa771-89bd-49a7-8a91-206c5a14c089