amazon-web-servicesdockeraws-lambda

Lambda container images complain about entrypoint needing handler name as the first argument


When I run an AWS Lambda container (Docker) image, for example:

docker run public.ecr.aws/lambda/java bash

I get the following error:

entrypoint requires the handler name to be the first argument

What should the handler name be?


Solution

  • It depends what the language is of the runtime. For example, if it is NodeJS, then the handler name should look like:

    "app.handler"
    

    If it is Java, then it should look like:

    "com.example.LambdaHandler::handleRequest"
    

    The image will look for them in LAMBDA_TASK_ROOT so you will need to make sure that your code (or compiled code) is copied to that folder when you build the image, for example:

    COPY target/* ${LAMBDA_TASK_ROOT}