I am trying to implement a custom runtime in AWS Lambda.
I have built the dockerfile and it runs in my local environment fine, including with the aws-lambda-rie. Running the built image locally like this, works fine.
docker run -p 9000:8080 myImage
And I know it works fine becuase if I poke it with Postman, I can see the code within the container running as expected:
http://127.0.0.1:9000/2015-03-31/functions/function/invocations
When I upload the image to AWS ECR and create an AWS Lambda function using that image though, it fails very quickly with a not-all-that-helpful error message.
Error: Runtime exited with error: exit status 1
I gather this is all related to filestructures and entrypoints, but I can't fathom it... In my dockerfile, I have this:
ENTRYPOINT [ "/home/entry_script.sh" ]
CMD [ "app.main" ]
app.py is inside /home/
Inside entry_script.sh, I have:
#!/bin/sh
if [ -z "${AWS_LAMBDA_RUNTIME_API}" ]; then
exec /usr/bin/aws-lambda-rie/aws-lambda-rie python3 -m awslambdaric $@
else
exec /usr/bin/python3 -m awslambdaric $@
fi
The aws-lambda-rie part of this, which runs when the image is on my local machine, seems fine as the code runs. I can't really tell what's happening though when I try to run this in Lambda.
I'm going wrong somewhere, but can't spot it... please help.
Thank you.