-
Notifications
You must be signed in to change notification settings - Fork 348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong queryStringParameters
after serializing AlbTargetGroupRequest
.
#954
Comments
This is actually the correct behavior. You can verify this by using a real alb to trigger a Lambda function. |
Tested with a real ALB (multi-value-headers disabled) and a nodejs lambda function to print the event using Case 1: curl 1234567890.us-east-1.elb.amazonaws.com/lambda?k=v Output: {
"requestContext": {
"elb": {
"targetGroupArn": "arn:aws:elasticloadbalancing:us-east-1:1234567890:targetgroup/lambda-print-request/1234567890"
}
},
"httpMethod": "GET",
"path": "/lambda",
"queryStringParameters": {
"k": "v"
},
"headers": {
"accept": "*/*",
"host": "1234567890.us-east-1.elb.amazonaws.com",
"user-agent": "curl/8.9.1",
"x-amzn-trace-id": "Root=1-1234567890-1234567890",
"x-forwarded-for": "1.1.1.1",
"x-forwarded-port": "80",
"x-forwarded-proto": "http"
},
"body": "",
"isBase64Encoded": false
} Case 2: curl "1234567890.us-east-1.elb.amazonaws.com/lambda?k=v&k=v2" Output: {
"requestContext": {
"elb": {
"targetGroupArn": "arn:aws:elasticloadbalancing:us-east-1:1234567890:targetgroup/lambda-print-request/1234567890"
}
},
"httpMethod": "GET",
"path": "/lambda",
"queryStringParameters": {
"k": "v2"
},
"headers": {
"accept": "*/*",
"host": "1234567890.us-east-1.elb.amazonaws.com",
"user-agent": "curl/8.9.1",
"x-amzn-trace-id": "Root=1-1234567890-1234567890",
"x-forwarded-for": "1.1.1.1",
"x-forwarded-port": "80",
"x-forwarded-proto": "http"
},
"body": "",
"isBase64Encoded": false
} The behavior follows the documentation:
|
…e last value of each key and prevent unnecessary mem alloc. awslabs#954
Currently
AlbTargetGroupRequest::query_string_parameters
is serialized with the defaultQueryMap
serializer, which will serialize the value as a list instead of a string.aws-lambda-rust-runtime/lambda-events/src/event/alb/mod.rs
Lines 19 to 20 in f69280e
It should be serialized like in APIGW event, using
query_map::serde::aws_api_gateway_v1::serialize_query_string_parameters
.aws-lambda-rust-runtime/lambda-events/src/event/apigw/mod.rs
Lines 34 to 35 in f69280e
Minimal repro:
Got output:
Expected: the value of
"k"
inqueryStringParameters
should be a string"v"
instead of a list["v"]
.The text was updated successfully, but these errors were encountered: