gpt4 book ai didi

amazon-web-services - 错误 : exec: \"app.handler\": executable file not found in $PATH", "errorType": "Runtime.InvalidEntrypoint"

转载 作者:行者123 更新时间:2023-12-03 08:04:56 25 4
gpt4 key购买 nike

我正在 Lambda 上测试我的代码,之前从未收到过此错误,并且在网上找不到任何解决方案。我为我的代码创建了一个 docker 镜像,因此这是我推送到 ECR 的 Docker 文件

FROM python:3.8

# Copy function code
COPY app.py ${LAMBDA_TASK_ROOT}

#Copy and install requirements
COPY requirements.txt ${LAMBDA_TASK_ROOT}
RUN pip install -r requirements.txt

ARG GITHUB_ACCESS_TOKEN
ARG TABLE_NAME
ARG AWS_ACCESS_KEY
ARG AWS_SECRET_KEY
ARG REGION

ENV GITHUB_ACCESS_TOKEN $GITHUB_ACCESS_TOKEN
ENV TABLE_NAME $TABLE_NAME
ENV AWS_ACCESS_KEY $AWS_ACCESS_KEY
ENV AWS_SECRET_KEY $AWS_SECRET_KEY
ENV REGION $REGION

# Set the CMD to the handler
CMD [ "app.handler" ]

这也是我的 lambda 日志中显示的完整错误

START RequestId: d691e14e-349f-45c5-a4a7-b1b98a3e88be Version: $LATEST
IMAGE Launch error: exec: "app.handler": executable file not found in $PATH Entrypoint: [] Cmd: [app.handler] WorkingDir: []IMAGE Launch error: exec: "app.handler": executable file not found in $PATH Entrypoint: [] Cmd: [app.handler] WorkingDir: []END RequestId: d691e14e-349f-45c5-a4a7-b1b98a3e88be
REPORT RequestId: d691e14e-349f-45c5-a4a7-b1b98a3e88be Duration: 6.80 ms Billed Duration: 7 ms Memory Size: 128 MB Max Memory Used: 2 MB
RequestId: d691e14e-349f-45c5-a4a7-b1b98a3e88be Error: exec: "app.handler": executable file not found in $PATH
Runtime.InvalidEntrypoint

最佳答案

Lambda 镜像不是由 python:3.8 Docker 镜像制作的。相反,它们应该由 public.ecr.aws/lambda/python:3.8 制成。 lambda 容器镜像必须专门构建才能与 lambda 正常工作。

AWS 文档详细解释了这一点:

关于amazon-web-services - 错误 : exec: \"app.handler\": executable file not found in $PATH", "errorType": "Runtime.InvalidEntrypoint",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72667058/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com