`sam build` broken after upgrading SAM CLI when using ECR (backward compatibility issue)
See original GitHub issueDescription:
I have a SAM application with an AWS ECR repository configured as the storage for the app snapshots/releases.
So far I was using just sam build
and sam deploy
to deploy my SAM application. It used to work with SAM CLI 1.24.1.
Unfortunately after I upgraded to SAM CLI 1.27.2 it stopped working. Now sam build
says:
The resource AWS::Serverless::Function ‘HelloFunction’ has specified ECR registry image for ImageUri. It will not be built and SAM CLI does not support invoking it locally.
Upgrading SAM CLI to the current latest version 1.30.0 doesn’t help either.
This is a breaking change. Not sure if it was announced anywhere. Also it seems the problem was introduced as part of #2934.
Honestly I don’t know what I should do now and how I should fix it. For now I can stick to the SAM CLI version that works for me but this is only a temporary solution.
Steps to reproduce:
Create a SAM app with a template including:
Resources:
HelloFunction:
Type: AWS::Serverless::Function
Properties:
PackageType: Image
ImageUri: <account-number>.dkr.ecr.<region>.amazonaws.com/hello-app
Metadata:
Dockerfile: Dockerfile
DockerContext: ./app
DockerTag: python3.8-v1
Use sam build
and then guided deploy with SAM CLI 1.24.1. Then upgrade to SAM CLI 1.27.2 - sam build
will stop working.
Observed result:
sam build
doesn’t build the image anymore and sam deploy
doesn’t push the image to ECR. As a result sam deploy
fails.
Expected result:
sam build
should build the image, as it used to. sam deploy
should push the image to ECR and update the app without issues.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
- OS: Ubuntu 20.04
sam --version
: 1.24.1, 1.27.2, 1.30.0- AWS region: Ireland (eu-west-1)
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (8 by maintainers)
Are you able to reproduce the issue?
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.