amazon-web-servicesaws-lambdaalexa-skills-kit

No module named awslambdaric in AWS Lambda in Container


I'm running an AWS Python Lambda Function from a Docker container. I get the error message in CloudWatch: "No module named awslambdaric"

I tried installing it directly in the Docker container or via a requirements.txt.

Docker Container

RUN pip install -r requirements.txt
RUN pip install awslambdaric

Entrypoint and Docker image

FROM public.ecr.aws/lambda/python:3.10
ENTRYPOINT ["/var/runtime/custom_entrypoint"]
exec env ALL_PROXY="socks5://localhost:1055/" /var/lang/bin/python3.10 -m awslambdaric $@

Error:

2024-04-24T08:18:02.922+02:00   /var/lang/bin/python3.10: No module named awslambdaric
2024-04-24T08:18:03.039+02:00   INIT_REPORT Init Duration: 1754.90 ms Phase: invoke Status: error Error Type: Runtime.ExitError
2024-04-24T08:18:03.039+02:00   START RequestId: 1a5a7764-5e5f-4692-8883-5e065c87c536 Version: $LATEST
2024-04-24T08:18:03.060+02:00   RequestId: 1a5a7764-5e5f-4692-8883-5e065c87c536 Error: Runtime exited with error: exit status 1 Runtime.ExitError
2024-04-24T08:18:03.060+02:00   END RequestId: 1a5a7764-5e5f-4692-8883-5e065c87c536
2024-04-24T08:18:03.060+02:00   REPORT RequestId: 1a5a7764-5e5f-4692-8883-5e065c87c536 Duration: 1775.85 ms Billed Duration: 1776 ms Memory Size: 128 MB Max Memory Used: 18 MB

requirements.txt

isodate~=0.6.0
pydantic~=1.10.4
typing-extensions~=4.10.0
urllib3
pysocks 
awslambdaric 
ask_sdk_core 
ask_sdk_model 

Solution

  • Into the docker container the install command is:

    RUN pip install -t . awslambdaric