Skip to content

Feature Request: Add Support for Lambda proxy integrations for HTTP API #9

@vladaman

Description

@vladaman

I reviewed this proxy and seems pretty cool replacement for AWS API Gateway (REST). But I feel it's actually closer to HTTP API Gateway. It would be nice to support Payload 2.0 format for HTTP API. This way it could be instant replacement for AWS HTTP Gateway as well.

See https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html

I've done simpe test and this actually works (but missing proper implementation):

 const params = {
                ClientContext: clientContext,
                FunctionName: target,
                LogType: logType,
                InvocationType: invocationType,
                Qualifier: qualifier,
                Payload: JSON.stringify({
                        "version": "2.0",
                        "routeKey": "$default",
                        "rawPath": "/app-user/stec",
                        "rawQueryString": "parameter1=value1&parameter1=value2&parameter2=value",
                        "cookies": [
                            "cookie1",
                            "cookie2"
                        ],
                        "headers": {
                            "Content-type": "appliction/json"
                        },
                        "queryStringParameters": {
                            "parameter1": "value1,value2",
                            "parameter2": "value"
                        },
                        "requestContext": {
                            "accountId": "123456789012",
                            "apiId": "api-id",
                            "authentication": {
                                "clientCert": {
                                    "clientCertPem": "CERT_CONTENT",
                                    "subjectDN": "www.example.com",
                                    "issuerDN": "Example issuer",
                                    "serialNumber": "a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1",
                                    "validity": {
                                        "notBefore": "May 28 12:30:02 2019 GMT",
                                        "notAfter": "Aug  5 09:36:04 2021 GMT"
                                    }
                                }
                            },
                            "authorizer": {
                                "jwt": {
                                    "claims": {
                                        "claim1": "value1",
                                        "claim2": "value2"
                                    },
                                    "scopes": [
                                        "scope1",
                                        "scope2"
                                    ]
                                }
                            },
                            "domainName": "id.execute-api.us-east-1.amazonaws.com",
                            "domainPrefix": "id",
                            "http": {
                                "method": "GET",
                                "path": "/app-user/steve",
                                "protocol": "HTTP/1.1",
                                "sourceIp": "IP",
                                "userAgent": "agent"
                            },
                            "requestId": "id",
                            "routeKey": "$default",
                            "stage": "$default",
                            "time": "12/Mar/2020:19:03:58 +0000",
                            "timeEpoch": 1583348638390
                        },
                        "body": "Hello from Lambda",
                        "pathParameters": {
                            "parameter1": "value1"
                        },
                        "isBase64Encoded": false,
                        "stageVariables": {
                            "stageVariable1": "value1",
                            "stageVariable2": "value2"
                        }
            }
                    )}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions