aws / aws-lambda-runtime-interface-emulator

Apache License 2.0
921 stars 95 forks source link

Getting a 502 Bad Gateway response during the local testing of the container based lambda #37

Open skulkarni56-bb opened 3 years ago

skulkarni56-bb commented 3 years ago

I am following the example here https://pypi.org/project/awslambdaric/ . When I run the curl command to test the lambda I get no response. With the increased verbosity in the curl command I get the error 502 Bad gateway. The peculiar thing is that sending curl command again hangs - with the last message being "upload completely sent off: 2 out of 2 bytes". A standard docker nginx test works fine (something similar to https://www.docker.com/blog/how-to-use-the-official-nginx-docker-image/)

jonife commented 3 years ago

Hello @skulkarni56-bb, sorry this issue was not picked up earlier, let us know if you already fixed this issue. This is a behavior that could happen when the image used is not totally compatible with Lambda (or it doesn't have the right entrypoint), so we would like to ask for more information to further understand the issue 1 Did you use the Dockerfile specified in the RIC instructions from the link you provided? 2 Did you build that Dockerfile first and added its name:tag to the docker run command? 3 If you used a different Dockerfile, what file did you use? Thank you,

CommonCrisis commented 2 years ago

Hi, I have the same issue with using the public.ecr.aws/lambda/python:3.8 image. I can visit http://localhost:9000/2015-03-31/functions/function/invocations with my browser but I cannot Post to the endpoint - it just keeps on going forever:

* Connected to localhost (127.0.0.1) port 9000 (#0)
> POST /2015-03-31/functions/function/invocations HTTP/1.1
> Host: localhost:9000
> User-Agent: curl/7.75.0
> Accept: */*
> Content-Length: 2
> Content-Type: application/x-www-form-urlencoded
>
} [2 bytes data]
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 Connection Established
< Proxy-Agent: Ztunnel/1.0
* no chunk, no close, no size. Assume close to signal end
*