3

I made a call to an API Gateway connected to a Lambda function. I was expecting to see multiValueQueryStringParameters as a key in the event input to my handler.

https://aws.amazon.com/blogs/compute/support-for-multi-value-parameters-in-amazon-api-gateway/

Instead, I was seeing a comma delimited list in queryStringParameters

So for example, this call:

https://12324234234234.execute-api.us-east-2.amazonaws.com/dois_to_pmids?a=1&a=2&a=3

generates the following event entry:

"queryStringParameters": {"a": "1,2,3"}

I tried making everything a proxy integration, first be doing:

GET /{proxy+}

and then by doing:

ANY /{proxy+}

with no luck.

https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-set-up-simple-proxy.html

https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html

What's going on?

1

1 Answer 1

8

So after a bit of digging I discovered an option when setting up the integration to select a payload version (either 1 or 2). You can currently read about the payload version formats (sort of, details are a bit light) here:

https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html

The main takeaway from that link is that version 2 doesn't have multiValueQueryStringParameters, instead repeated parameters are concatenated together in a comma separated list (as observed).

Haven't tested how this works with values that have commas :/

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for digging this up Jimbo, you've saved me the effort.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.