3

I'm trying to deploy a docker image as a lambda function via AWS SAM. My SAM template looks something like:

Resources:
  StrapiFunction:
    Type: AWS::Serverless::Function
    Properties:
      PackageType: Image
      Events:
        Strapi:
          Type: Api
          Properties:
            Path: /
            Method: ANY
    Metadata:
      DockerTag: latest
      DockerContext: ./
      Dockerfile: Dockerfile

Which I'm then trying to deploy (via a CI script) with:

sam deploy  \
    --resolve-s3 \
    --resolve-image-repos \
    --region ${AWS_REGION} \
    --template-file ${SAM_FILE} \
    --stack-name my-cms-${STAGE}-stack \
    --capabilities CAPABILITY_NAMED_IAM

From the docs, --resolve-image-repos tells SAM to "Automatically create Amazon ECR repositories to use for packaging and deploying for non-guided deployments".

If I try to deploy this, I get an error:

Unable to upload artifact None referenced by ImageUri parameter

But if the repository is being created by SAM, I don't know its URI in advance. And from what I can see, it changes each time the deploy is run.

What am I missing?

Wintermute
  • 2,973
  • 4
  • 32
  • 52

0 Answers0