aws / aws-lambda-runtime-interface-emulator

Apache License 2.0
939 stars 99 forks source link

Support for emulating ALB? #8

Closed tomyan closed 3 years ago

tomyan commented 3 years ago

More of a question or perhaps a feature request, but does it support emulating an ALB? I'm returning a ALBTargetGroupResponse struct from the github.com/aws/aws-lambda-go/events package:

return events.ALBTargetGroupResponse{
    Body:       "Not Found",
    StatusCode: 404,
}

When I make a request of the emulator I get a 200 response back:

< HTTP/1.1 200 OK
< Date: Mon, 07 Dec 2020 20:48:02 GMT
< Content-Length: 124
< Content-Type: text/plain; charset=utf-8
< 
* Connection #0 to host localhost left intact
{"statusCode":404,"statusDescription":"","headers":null,"multiValueHeaders":null,"body":"Not Found","isBase64Encoded":false}* Closing connection 0

Is there a way to get the emulator to return the http response as you would receive if an ALB had invoked the lambda? If not are there any plans to support this in the future?

Thanks

Tom

jfuss commented 3 years ago

Thanks for the request @tomyan, as of now this is out of scope for this project. This project is centered around providing the Lambda Runtime API and a short cut to invoke that is similar to the Lambda invoke Api. Emulating other invoke events or services is not something we are targeting for this project. You should be able to create a small wrapper that emulates ALB and invokes RIE as an alternative.