Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: exec: \"app.handler\": executable file not found in $PATH", "errorType": "Runtime.InvalidEntrypoint"

I'm testing my code on Lambda and I've never received this error before and couldn't find any solutions online. I created a docker image for my code, so here's my Docker file that I pushed to ECR

FROM python:3.8

# Copy function code
COPY app.py ${LAMBDA_TASK_ROOT}

#Copy and install requirements
COPY requirements.txt ${LAMBDA_TASK_ROOT}
RUN pip install -r requirements.txt

ARG GITHUB_ACCESS_TOKEN
ARG TABLE_NAME
ARG AWS_ACCESS_KEY
ARG AWS_SECRET_KEY
ARG REGION

ENV GITHUB_ACCESS_TOKEN $GITHUB_ACCESS_TOKEN
ENV TABLE_NAME $TABLE_NAME
ENV AWS_ACCESS_KEY $AWS_ACCESS_KEY
ENV AWS_SECRET_KEY $AWS_SECRET_KEY
ENV REGION $REGION

# Set the CMD to the handler 
CMD [ "app.handler" ]

Also here's the full error that showed up in my logs on lambda

START RequestId: d691e14e-349f-45c5-a4a7-b1b98a3e88be Version: $LATEST
IMAGE   Launch error: exec: "app.handler": executable file not found in $PATH   Entrypoint: []  Cmd: [app.handler]  WorkingDir: []IMAGE Launch error: exec: "app.handler": executable file not found in $PATH   Entrypoint: []  Cmd: [app.handler]  WorkingDir: []END RequestId: d691e14e-349f-45c5-a4a7-b1b98a3e88be
REPORT RequestId: d691e14e-349f-45c5-a4a7-b1b98a3e88be  Duration: 6.80 ms   Billed Duration: 7 ms   Memory Size: 128 MB Max Memory Used: 2 MB   
RequestId: d691e14e-349f-45c5-a4a7-b1b98a3e88be Error: exec: "app.handler": executable file not found in $PATH
Runtime.InvalidEntrypoint
like image 205
MP32 Avatar asked Dec 02 '25 17:12

MP32


1 Answers

Lambda images are not made from python:3.8 Docker image. Instead they should be made from public.ecr.aws/lambda/python:3.8. The lambda container images must be specially constructed to work correctly with lambda.

AWS docs explain this in details:

  • Create a Python image from an AWS base image
like image 198
Marcin Avatar answered Dec 05 '25 07:12

Marcin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!