Skip to content
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

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

Open
vladaman opened this issue Sep 2, 2022 · 0 comments

Comments

@vladaman
Copy link

vladaman commented Sep 2, 2022

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"
                        }
            }
                    )}
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

No branches or pull requests

1 participant