Skip to content

Unable to pass query string parameters to .NET Core Web API running in Lambda  #1164

Description

@sudarshankonge

Describe the bug

  1. I have a Lambda function which is running a .NET Core Web API app from a container image. I am using .NET 6 for the Lambda.

  2. I am using Lambda proxy integration with API gateway.

  3. One of my APIs takes two query string parameters named start and end,
    image

  4. I made the requisite changes so that API gateway can accept query string parameters as shown below,
    image

When I try to invoke the above API from Postman, I get a 404 not found error. This is how the API looks,
GET https://xxxxxxx-api.ap-south-1.amazonaws.com/dev/api/v1/stock-exchange/nse/time-series/INFY?start=2022-04-26&end=2022-04-30

Can someone please help me debug this. From the logs, I can clearly see that the query string params are there in the request that Lambda gets but why is my controller action failing to be invoked ?

Expected Behavior

WebAPI controller action must be invoked when I execute the API with the query string parameters.

Current Behavior

This is the output I get after setting LAMBDA_NET_SERIALIZER_DEBUG to true.

{
    "resource": "/{proxy+}",
    "path": "/api/v1/stock-exchange/nse/time-series/INFY",
    "httpMethod": "GET",
    "headers": {
        "Accept": "*/*",
        "Accept-Encoding": "gzip, deflate, br",
        "Host": "xxxxx-api.ap-south-1.amazonaws.com",
        "Postman-Token": "65ae1a29-803a-4c17-8ede-6c02fa0c4578",
        "User-Agent": "PostmanRuntime/7.29.0",
        "X-Amzn-Trace-Id": "Root=1-626c2e55-707affc125a142870c4febb9",
        "X-Forwarded-For": "106.201.80.99",
        "X-Forwarded-Port": "443",
        "X-Forwarded-Proto": "https"
    },
    "multiValueHeaders": {
        "Accept": [
            "*/*"
        ],
        "Accept-Encoding": [
            "gzip, deflate, br"
        ],
        "Host": [
            "xxxxxxxx-api.ap-south-1.amazonaws.com"
        ],
        "Postman-Token": [
            "65ae1a29-803a-4c17-8ede-6c02fa0c4578"
        ],
        "User-Agent": [
            "PostmanRuntime/7.29.0"
        ],
        "X-Amzn-Trace-Id": [
            "Root=1-626c2e55-707affc125a142870c4febb9"
        ],
        "X-Forwarded-For": [
            "106.201.80.99"
        ],
        "X-Forwarded-Port": [
            "443"
        ],
        "X-Forwarded-Proto": [
            "https"
        ]
    },
    "queryStringParameters": {
        "end": "2022-04-30",
        "start": "2022-04-26"
    },
    "multiValueQueryStringParameters": {
        "end": [
            "2022-04-30"
        ],
        "start": [
            "2022-04-26"
        ]
    },
    "pathParameters": {
        "proxy": "api/v1/stock-exchange/nse/time-series/INFY"
    },
    "stageVariables": null,
    "requestContext": {
        "resourceId": "xxxxxxx",
        "resourcePath": "/{proxy+}",
        "httpMethod": "GET",
        "extendedRequestId": "RWwtdF9OBcwFuTQ=",
        "requestTime": "29/Apr/2022:18:28:37 +0000",
        "path": "/dev/api/v1/stock-exchange/nse/time-series/INFY",
        "accountId": "xxxxxxxxxx",
        "protocol": "HTTP/1.1",
        "stage": "dev",
        "domainPrefix": "gs9bhhllvh",
        "requestTimeEpoch": 1651256917914,
        "requestId": "0ed0b37f-bfd1-4c26-b18c-9313388ad4b8",
        "identity": {
            "cognitoIdentityPoolId": null,
            "accountId": null,
            "cognitoIdentityId": null,
            "caller": null,
            "sourceIp": "106.201.80.99",
            "principalOrgId": null,
            "accessKey": null,
            "cognitoAuthenticationType": null,
            "cognitoAuthenticationProvider": null,
            "userArn": null,
            "userAgent": "PostmanRuntime/7.29.0",
            "user": null
        },
        "domainName": "xxxxxxxxxxx-api.ap-south-1.amazonaws.com",
        "apiId": "xxxxxxxxxx"
    },
    "body": null,
    "isBase64Encoded": false
}


Reproduction Steps

GET https://xxxxxxx-api.ap-south-1.amazonaws.com/dev/api/v1/stock-exchange/nse/time-series/INFY?start=2022-04-26&end=2022-04-30

image

Executing the above API should invoke the WebAPI controller above but that doesn't happen and I get a 404 not found instead.

Possible Solution

No response

Additional Information/Context

No response

AWS .NET SDK and/or Package version used

AWSSDK 2.3.55.2

Targeted .NET Platform

.NET 6

Operating System and version

Lambda

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.module/aspnetcore-supportresponse-requestedWaiting on additional info and feedback. Will move to close soon in 7 days.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions