aws batch failure: "entrypoint requires the handler name to be the first argument"

0

I'm getting starting trying to make jobs run via AWS batch. My first submitted job failed with "entrypoint requires the handler name to be the first argument" logged to cloudwatch.

Where should I start in tracing the source of the problem?

Here is my dockerfile:

FROM public.ecr.aws/lambda/python:3.12

# Copy requirements.txt
COPY requirements.txt .

# Install the specified packages
RUN pip install -r requirements.txt

# Copy function code
COPY dojob.py .

# no CMD line --will set the command to be run in the 
# in the job definition via the AWS console.

And here is my job definition:

{
  "jobDefinitionName": "blw-md-batch-job-definition",
  "jobDefinitionArn": "arn:aws:batch:us-east-2:590183906166:job-definition/blw-md-batch-job-definition:1",
  "revision": 1,
  "status": "ACTIVE",
  "type": "container",
  "parameters": {},
  "containerProperties": {
    "image": "590183906166.dkr.ecr.us-east-2.amazonaws.com/blw-md-batch-repo:latest",
    "command": [
      "python3",
      "dojob.py"
    ],
    "jobRoleArn": "arn:aws:iam::590183906166:role/ecsTaskExecutionRole",
    "executionRoleArn": "arn:aws:iam::590183906166:role/ecsTaskExecutionRole",
    "volumes": [],
    "environment": [
      {
        "name": "BLW-MD-JOBID",
        "value": "27e0f6ed-01e4-434d-b438-c9cc59169e3d"
      }
    ],
    "mountPoints": [],
    "ulimits": [],
    "resourceRequirements": [
      {
        "value": "2.0",
        "type": "VCPU"
      },
      {
        "value": "10240",
        "type": "MEMORY"
      }
    ],
    "secrets": [],
    "networkConfiguration": {
      "assignPublicIp": "ENABLED",
      "interfaceConfigurations": []
    },
    "fargatePlatformConfiguration": {
      "platformVersion": "LATEST"
    },
    "runtimePlatform": {
      "operatingSystemFamily": "LINUX",
      "cpuArchitecture": "X86_64"
    }
  },
  "timeout": {
    "attemptDurationSeconds": 1800
  },
  "tags": {
    "blw-make-dataset": ""
  },
  "propagateTags": true,
  "platformCapabilities": [
    "FARGATE"
  ],
  "containerOrchestrationType": "ECS"
}

Thanks!

stu
asked 15 days ago247 views
1 Answer
1
Accepted Answer

Turns out the problem is that I was using a base image specific to aws lambda. i.e. my dockerfile started with

FROM public.ecr.aws/lambda/python:3.12

When I switched to

FROM python:3.12.4-alpine

things work as expected!

stu
answered 15 days ago
profile picture
EXPERT
reviewed 15 days ago