bug: Step Functions apigateway:invoke: list-valued Headers reach API Gateway as a bracketed string (["v"] → [v])
#59
Closed
k-rooot
started this conversation in
Bugs (AWS)
Replies: 2 comments
|
Hello @k-rooot and thanks a lot for the report! The issue should be fixed in the latest Thanks again for the report! Let me know if it still doesn't work. |
0 replies
|
Hello @k-rooot and thanks for the report. The fix is available in the |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Current behavior
In a Step Functions task using
arn:aws:states:::apigateway:invoke, header values given in the list form documented by AWS ("Headers": {"x-api-key": ["value"]}) arrive at API Gateway as the string representation of the list:Parameters.Headers{"x-single": ["value1"]}x-single: [value1]{"x-multi": ["a", "b"]}x-multi: [a,b]{"x-single": "value1"}(plain string)x-single: value1A practical consequence: an API key passed in the documented list form (
"x-api-key": ["<key>"]) never matches, and a REST API method withapiKeyRequired: trueanswers403 Forbidden. The LocalStack log showsError raised during invocation: INVALID_API_KEY. The same key sent as a plain string is accepted.Expected behavior
As on AWS: each list element is sent as a value of that header, so
["value1"]arrives asvalue1and["a", "b"]arrives as two values (a,bwhen combined). The AWS documentation for the API Gateway integration states that "HTTP headers allow a list of values associated with the same key" and shows"Headers": {"key": ["value1", "value2"]}(https://docs.aws.amazon.com/step-functions/latest/dg/connect-api-gateway.html).How are you starting LocalStack?
With a
docker runcommand:Steps to reproduce
Self-contained script (boto3 only): it creates a MOCK REST API that echoes two request headers, then calls it from a state machine with the list form and with the string form. Script:
Output:
The result is the same whether
AuthTypeis omitted,NO_AUTH,IAM_ROLEorRESOURCE_POLICY, and whetherPathhas a leading/.Environment
localstack/localstack-pro:2026.7.5andlocalstack/localstack-pro:2026.8.1Anything else?
Workaround: write single-value headers as plain strings in the state machine definition. That only works where the definition can be changed, and multi-value headers have no workaround.
All reactions