So i have a serverless app where i am sending the request to an alb which gets redirected to a lambda function. My request is
/?filePath=a&filePath=b&filePath=c&filePath=d&pageSize=2
but in the event being passed to the lambda its shown as below:-
{
"requestContext": {
"elb": {
"targetGroupArn": "xyz"
}
},
"httpMethod": "GET",
"path": "/xyz",
"queryStringParameters": {
"filePath": "d",
"page": "1",
},
So, essentially instead of taking all the input files as a list in
event.mutliValueStringQueryParameters: ['a', 'b', 'c', 'd']
, its taking only the last element as the queryParam.
My serverless alb event for this API is this:-
- alb:
listenerArn: XXX
priority: 2
multiValueQueryStringParameters: true
conditions:
path: XXX
method: GET
- http:
path: XXX
method: GET
Any help is appreciated.
I haven't tried this myself but I think you need to use a proxy integration to get the multiValueQueryStringParameters
field.
https://aws.amazon.com/blogs/compute/support-for-multi-value-parameters-in-amazon-api-gateway/
https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html
Note, when selecting an integration you can choose the payload version. If you select 2 there are no such proxy restrictions but instead of getting multiValueQueryStringParameters
your values are concatenated together in a comma-delimited list.
"filePath" : "a,b,c,d"