aws / aws/aws-extensions-for-dotnet-cli

Projects with a mix of Zip and Image functions do not package correctly.

Open
#212 0 comments 0 reactions 0 assignees View on GitHub
bug module/cli-ext p2 queued
Dominant language
C#
Stars
393
Forks
90
Avg merge
2d 19m
Merged PRs (30d)
3

Description

### Describe the bug

When deploy a project using the `deploy-serverless` command. If the CloudFormation template has a mix of Image and Zip package type functions the packaged CloudFormation template with the links to the uploaded deployment bundles will be incorrect.

This is because `deploy-serverless` makes a cache of project bundles once per project path. Not expecting functions to have different deployment packages per function in the same project. If the template first declares a function as `Image` package type the tool will build the container image and push it to ECR. The function in the template will point to the image uri in ECR. If a second function is then processed of package type `Zip` the tool will see the project has already been build and will skip doing a `dotnet publish` and uploading to S3. The Code Uri to S3 will not point to valid location in S3 and the overall deployment will fail.

### Expected Behavior

Both image and zip based functions are properly packaged and updated in the CloudFormation template before starting the CloudFormation stack creation.

### Current Behavior

Stack fails to create.

### Reproduction Steps

Have a collection of functions with some marked as package type `Zip` and others `Image.

### Possible Solution

_No response_

### Additional Information/Context

This is getting in the way of creating more robust integration testing for the Amazon.Lambda.Annotations package in the aws-lambda-dotnet repo.

### Targeted .NET platform

.NET 6

### CLI extension version

5.4.0 but the issue has existed since `Image` package type was introduced.

### Environment details (OS name and version, etc.)

Any

Contributor guide

Open the contributing guide

Research direction

Start at the deploy-serverless command and trace how it caches project bundles and handles Image versus Zip package types. Reproduce a project containing both function types, then verify that the packaged CloudFormation template contains valid ECR image and S3 bundle references before stack creation.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, csharp
Domain
cli, cloud, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.