Skip to content

fix: forward single-value query params in awslambda MultiValueQueryStringParameters - #8

Merged
bramwelt merged 2 commits into
aws-lambda-v2.11from
fix/awslambda-single-value-query-params
Aug 7, 2026
Merged

fix: forward single-value query params in awslambda MultiValueQueryStringParameters#8
bramwelt merged 2 commits into
aws-lambda-v2.11from
fix/awslambda-single-value-query-params

Conversation

@ahmedomosanya

Copy link
Copy Markdown

Summary

valuesToMultiMap in pkg/middlewares/awslambda/aws_lambda.go excluded every
single-value query parameter (len(value) == 1), so MultiValueQueryStringParameters
was only ever populated with multi-value keys. Because the receiver
(aws-lambda-go-api-proxy core/request.go) reads MultiValueQueryStringParameters
exclusively once it is non-empty, any request with ≥1 multi-value parameter
silently dropped all single-value parameters
before they reached the Lambda.

This forwards single-value params as 1-element slices as well, so every query key
is present — matching real AWS API Gateway semantics.

Change

// pkg/middlewares/awslambda/aws_lambda.go — valuesToMultiMap
- if !valid || len(value) == 1 {
+ if !valid {
     continue
 }

Test

  • Updated Test_AWSLambdaMiddleware_InvokeBasic (pkg/middlewares/awslambda/aws_lambda_test.go):
    MultiValueQueryStringParameters now expects the single-value keys
    ({"a":{"1"}, "b":{"2"}, "c":{"3","4"}, "d[]":{"5","6"}}) rather than only the
    multi-value ones.
  • Added an assertion that every query key in the input appears in the forwarded output.
  • go test ./pkg/middlewares/awslambda/... green.

Note

Consumers that pin a built image of this fork will need to rebuild and redeploy to
pick up the change.

…ringParameters

valuesToMultiMap only populated MultiValueQueryStringParameters with query keys
that had more than one value; it skipped any key with a single value
(len(value) == 1). The receiver (aws-lambda-go-api-proxy core/request.go) reads
MultiValueQueryStringParameters exclusively once it is non-empty, so any request
that carried at least one multi-value query parameter silently dropped every
single-value parameter before it reached the Lambda.

Include single-value params as 1-element slices (drop the len(value) == 1
condition) so every query key is forwarded, matching real AWS API Gateway
semantics.

Update Test_AWSLambdaMiddleware_InvokeBasic so the fixture expects the
single-value keys alongside the multi-value ones, and add an assertion that no
input query key is missing from the forwarded output.

Signed-off-by: ahmedomosanya <aopeyemi@contractor.linuxfoundation.org>
Copilot AI balanced review requested due to automatic review settings August 6, 2026 14:20
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 66f36468-422d-4b94-8e93-f1cd72fe13ea

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes AWS Lambda query forwarding so multi-value parameters no longer cause single-value parameters to be dropped.

Changes:

  • Includes all valid query parameters in the multi-value map.
  • Updates regression coverage for mixed single- and multi-value queries.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
pkg/middlewares/awslambda/aws_lambda.go Forwards single-value query parameters as one-element slices.
pkg/middlewares/awslambda/aws_lambda_test.go Verifies all query keys reach the Lambda request.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings August 6, 2026 20:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (1)

pkg/middlewares/awslambda/aws_lambda.go:442

  • valuesToStrings can return (emptySlice, true) when val is a slice but all elements are filtered out as invalid. With the new condition, valuesToMultiMap will now include those keys with an empty slice, which is typically not a meaningful forwarded query parameter and can change behavior downstream. Consider also skipping when len(value) == 0 (or updating valuesToStrings to return valid=false when no elements survive conversion) so only keys with at least one forwarded value are included.
	values := map[string][]string{}
	for name, val := range i {
		value, valid := valuesToStrings(val)
		if !valid {
			continue
		}

@bramwelt

bramwelt commented Aug 6, 2026

Copy link
Copy Markdown

Waiting on GitHub actions to come back online so i can trigger the build and see tests pass before merging this in and getting it deployed.

@bramwelt

bramwelt commented Aug 6, 2026

Copy link
Copy Markdown

Closing and re-opening to trigger builds

@bramwelt bramwelt closed this Aug 6, 2026
@bramwelt bramwelt reopened this Aug 6, 2026
@bramwelt
bramwelt merged commit f2e8f33 into aws-lambda-v2.11 Aug 7, 2026
12 of 28 checks passed
@bramwelt
bramwelt deleted the fix/awslambda-single-value-query-params branch August 7, 2026 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants