-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
area/local/start-apisam local start-api commandsam local start-api commandstage/bug-reproThe issue/bug needs to be reproducedThe issue/bug needs to be reproducedstage/needs-investigationRequires a deeper investigationRequires a deeper investigation
Description
Description:
I have a simple lambda function which takes multiple query string parameters, however only the last query string parameter is kept.
Steps to reproduce:
I have defined a function as follows:
TestFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: rest_api/test/
Events:
GetTest:
Type: HttpApi
Properties:
Path: /api/test
Method: getThen run the application with sam local start-api --debug
Then sent a query to it using postman as a GET request: http://localhost:3000/api/test?test_ids=1&test_ids=2
Observed result:
The event output for the function is the following
Constructed String representation of Event Version 2.0 to invoke Lambda. Event:
{
"version": "2.0",
"routeKey": "GET /api/test",
"rawPath": "/api/test",
"rawQueryString": "test_ids=1&test_ids=2",
"cookies": [],
"headers": {
"Content-Type": "application/json",
"User-Agent": "PostmanRuntime/7.28.3",
"Accept": "*/*",
"Postman-Token": "cb0df40e-920d-4f8d-bbf8-9381f9ee5e45",
"Host": "localhost:3000",
"Accept-Encoding": "gzip, deflate, br",
"Connection": "keep-alive",
"Content-Length": "21",
"X-Forwarded-Proto": "http",
"X-Forwarded-Port": "3000"
},
"queryStringParameters": {
"test_ids": "2"
},
"requestContext": {
"accountId": "123456789012",
"apiId": "1234567890",
"http": {
"method": "GET",
"path": "/api/test",
"protocol": "HTTP/1.1",
"sourceIp": "127.0.0.1",
"userAgent": "Custom User Agent String"
},
"requestId": "46b22e74-8e33-4f90-8f5c-3af887356c8e",
"routeKey": "GET /api/test",
"stage": null
},
"body": "",
"pathParameters": {},
"stageVariables": null,
"isBase64Encoded": false
}Critically:
"queryStringParameters": {
"test_ids": "2"
},Expected result:
I expected the following parsing for the queryStringParameters, as per the documentation
"queryStringParameters": {
"test_ids": "1,2"
},Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
- OS: Windows 10
sam --version: 1.29.0- AWS region: ap-southeast-2
Add --debug flag to command you are running
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area/local/start-apisam local start-api commandsam local start-api commandstage/bug-reproThe issue/bug needs to be reproducedThe issue/bug needs to be reproducedstage/needs-investigationRequires a deeper investigationRequires a deeper investigation