question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`sam build` broken after upgrading SAM CLI when using ECR (backward compatibility issue)

See original GitHub issue

Description:

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)

  1. OS: Ubuntu 20.04
  2. sam --version: 1.24.1, 1.27.2, 1.30.0
  3. AWS region: Ireland (eu-west-1)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
romanek-adamcommented, Sep 9, 2021

Are you able to reproduce the issue?

0reactions
github-actions[bot]commented, Sep 27, 2021

⚠️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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

sam build - AWS Serverless Application Model
Build an AWS SAM application using the sam build command from the AWS SAM CLI.
Read more >
Deploying Your Stacks
The basic steps for deploying AWS SAM apps is: Install and compile Lambda function dependencies; Create Lambda code package zip files; Upload zip...
Read more >
Deep Dive into AWS SAM - YouTube
Serverless Application Model ( SAM ) is a template driven tool for creating and managing serverless applications. In just a few lines of...
Read more >
Tag Archives: AWS SAM - Noise
In this section, we provide the steps to create an IAM role and deploy a Lambda function using AWS SAM. Log in to...
Read more >
Let's Try Lambda Container Support with SAM CLI - hayao-k.dev
Therefore, the container image you create must implement the Lambda Runtime API and be compatible with Lambda functions. The AWS SAM CLI ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found