容器中的 AWS Lambda 中没有名为 awslambdaric 的模块

问题描述 投票:0回答:1

我正在从 Docker 容器运行 AWS Python Lambda 函数。我在 CloudWatch 中收到错误消息:“没有名为 awslambdaric 的模块”

我尝试直接将其安装在 Docker 容器中或通过requirements.txt 安装。

Docker 容器

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

入口点和 Docker 镜像

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 $@

错误:

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

需求.txt

isodate~=0.6.0
pydantic~=1.10.4
typing-extensions~=4.10.0
urllib3
pysocks 
awslambdaric 
ask_sdk_core 
ask_sdk_model 
amazon-web-services aws-lambda alexa-skills-kit
1个回答
0
投票

进入 docker 容器,安装命令是:

RUN pip install -t . awslambdaric
© www.soinside.com 2019 - 2024. All rights reserved.