i have a python script in which i have included a handler like this [lambda_handler] (https://phpout.com/wp-content/uploads/2024/03/ZLcFG.png) and i have a dockerfileDockerFile used to build image which i am using to make a container image which is pushed to ECR and used to make a lambda function.
The problem is i am getting is
{
"errorType": "Runtime.InvalidEntrypoint",
"errorMessage": "RequestId: 86339395-a02e-4122-b54e-9f80a7bfbd40 Error: exec: "lambda_function.lambda_handler": executable file not found in $PATH"
}
i am just not sure what to put as the entry point. i have tried different solution like changing the architecture and build
as i am using a M2 MAC i thought the architecture might be the problem and changed the build
docker buildx build --platform linux/amd64 -t lambda-function .
and tried but still getting the invalid entry when tested in lambda
2
Answers
As per AWS documentation you will need to move the "handler" file to Root Path. Which is defined with "${LAMBDA_TASK_ROOT}".
Use the COPY command to copy the function code and runtime dependencies to {LAMBDA_TASK_ROOT}, a Lambda-defined environment variable.
AWS Documentation: Python Deployment with Container Images
Thus, the Dockerfile should look like:
It seems like the error you’re encountering is related to the entry point specified for your Lambda function . Lambda expects the entry point to be a Python file and a function within that file , but it seems like it’s unable to find the executable file named lambda_function.lambda_handler .