Skip to content

sam build Fails in examples/fastapi Due to Missing Image Digest – Manual Docker Pull Required #607

@DhanukaSheyamPerera

Description

@DhanukaSheyamPerera

Description

Running sam build in the examples/fastapi directory results in the following error:

(.venv) dhanuka@Dhanukas-MacBook-Pro metana-platform-file-handling-sam-app % sam build
Building codeuri: /Users/dhanuka/Development/github_repositories/metana-platform-file-handling-sam-app runtime: None architecture: x86_64 functions: FastAPIFunction                                                                                                                                                          
Building image for FastAPIFunction function                                                                                                                                                                                                                                                                                   
Setting DockerBuildArgs for FastAPIFunction function                                                                                                                                                                                                                                                                          
Failed building function FastAPIFunction                                                                                                                                                                                                                                                                                      
Step 1/8 : FROM public.ecr.aws/docker/library/python:3.12-slim
3.12-slim: Pulling from docker/library/python 
f5cc5422ebcb: Pull complete 
e3586b415667: Pull complete 
59e22667830b: Pull complete 
4c665aba06d1: Pull complete 
Status: Downloaded newer image for public.ecr.aws/docker/library/python:3.12-slim ---> 9c1d9ed7593f
Step 2/8 : COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.9.1 /lambda-adapter /opt/extensions/lambda-adapter
0.9.1: Pulling from awsguru/aws-lambda-adapter 
134595beb8b0: Pull complete 
Status: Downloaded newer image for public.ecr.aws/awsguru/aws-lambda-adapter:0.9.1failed to export image: NotFound: content digest sha256:1efc3eb71726bfb67ec3c8e7359e30b6fbf840611bf078fa44050b613b40b820: not found

Build Failed
Error: failed to export image: NotFound: content digest sha256:1efc3eb71726bfb67ec3c8e7359e30b6fbf840611bf078fa44050b613b40b820: not found

This occurs during the Docker build step when executing:

COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.9.1 /lambda-adapter /opt/extensions/lambda-adapter

Temporary Solution

Manually pulling both required Docker images resolves the issue:

docker pull public.ecr.aws/docker/library/python:3.12-slim
docker pull public.ecr.aws/awsguru/aws-lambda-adapter:0.9.1

After doing this, sam build completes successfully.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions