Skip to content

How do I troubleshoot the "Runtime.InvalidEntrypoint" error for my Lambda function that's from a Docker container image?

2 minute read
0

When I try to create an AWS Lambda function from a Docker container image, I receive a "Runtime.InvalidEntrypoint" error.

Resolution

When you misconfigured an the entry in the Lambda function, you might receive a "Runtime.InvalidEntrypoint" error.

To resolve this issue, check the following configuration settings for your Lambda function:

  • Verify that the ENTRYPOINT and CMD arguments to your Docker container image include the absolute path as the location.

  • Make sure that the Docker container image doesn't contain a symbolic link (symlink) as the ENTRYPOINT.

  • Make sure that the ENTRYPOINT is correct in the Lambda function's configuration. The ENTRYPOINT must match the command in the container image's Dockerfile that's used for the runtime.

  • Verify that the Docker container image pushes to the correct Amazon Elastic Container Registry (Amazon ECR).

  • Make sure that the Docker image's architecture and the Lambda function match. Lambda supports arm64 and x86_64 instruction set architectures. To build the container image, use either the linux/amd64 or linux/arm64 platform.
    Example:

    docker build platform linux/amd64 -t docker-image:test
    
  • Verify that the Lambda deployment package has the correct security permissions. If the package doesn't have the correct permissions, you receive a "permission denied" error with the "Runtime.InvalidEntrypoint" error. For more information, see How do I troubleshoot "permission denied" or "unable to import module" errors when I upload a Lambda deployment package?

Related information

How do I create a Lambda layer using a simulated Lambda environment with Docker?

How do I use container images with Lambda?

AWS OFFICIALUpdated 6 months ago
4 Comments

Recieved the error "rror: fork/exec /lambda-entrypoint.sh: exec format error Runtime.InvalidEntrypoint"

Was able to resolve the error after adding respective architecture tag in docker file for runtime image "public.ecr.aws/lambda/python:3.11-x86_64",

replied 2 years ago

Thank you for your comment. We'll review and update the Knowledge Center article as needed.

AWS
MODERATOR
replied 2 years ago

@Nikhil Melakunta, thank so much for your solution!

replied a year ago

Use the official AWS Lambda Node.js 18 base image

FROM public.ecr.aws/lambda/nodejs:18

Install g++ and other required dependencies

RUN yum update -y &&
yum install -y gcc-c++ make &&
yum clean all &&
rm -rf /var/cache/yum

Copy package files

COPY package*.json ./

Install dependencies

RUN npm install --production

Copy function code

COPY . .

Set the handler

ENTRYPOINT [ "/lambda-entrypoint.sh" ] CMD [ "src/handlers/dsa/run.handler" ]

this is my docker file my handler is at /Users/gouravsingal/Desktop/personal/slazySloth_server/src/handlers/dsa/run.js slazySloth_server is my project name

and I am getting this error

2024-12-07T16:49:33.279Z RequestId: 8e9c3920-cc3a-445e-998c-f0ea1c4d4746 Error: fork/exec /lambda-entrypoint.sh: exec format error Runtime.InvalidEntrypoint

can somebody correct it

I am using the correct image uri

replied a year ago