How to transform HTTP requests to Lambda events exactly as AWS API Gateway does as an HTTP proxy?

0

I'm developing a Lambda service behind an API Gateway as an HTTP proxy[1].

As the docs say, API Gateway basically transforms the HTTP request into a JSON Lambda Event.

In order to support the development process, I wonder if there is a library I could use to do that: transform an HTTP request into a JSON Lambda Event.

That way I could develop locally, wrapping my lambda implementation in a dummy web server whose work would be to transform and pass the event to my code.

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

1 Risposta
1

I recommends that you use SAM CLI for local testing. Using SAM CLI you can invoke your functions locally using the sam local start-api command, that will start also a local API gateway and will invoke your code when you CURL the local end-point. You could also use sam local generate-event to create the event object that is used by API Gateway and use it when invoking the function directly using sam local invoke.

profile pictureAWS
ESPERTO
Uri
con risposta un anno fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande