aws / aws/aws-lambda-dotnet

aws lambda deploy-serverless command not updating Layer version when used with secrets manager

Open
#448 4 comments 0 reactions 0 assignees View on GitHub
feature-request module/lambda-client-lib p2 queued
Dominant language
C#
Stars
1.7k
Forks
503
Avg merge
1d 18h
Merged PRs (30d)
21

Description

When trying to update an existing Lambda function with a Lambda Layer using _aws lambda deploy-serverless_ command, it fails to update the function with the latest layer version when the Layer ARN is fetched from AWS Secrets Manager. Creating a new function with the same command works fine. Issue is only when we do consecutive updates to the same function.

### Scenario
* Create a Lambda Function with Layer
* Update the Layer using _dotnet lambda publish-layer_ command.
* Now run _aws lambda deploy-serverless_ command by passing a serverless template. Example command below

```
dotnet lambda deploy-serverless -sb my-lambda-apps -t .\serverless.yaml -sn OrderProcessor
```
* serverless.yaml command has the Layer settings as below. Layer ARN is stored as a key/value pair in AWS Secrets Manager.
```
Layers:
- '{{resolve:secretsmanager:LambdaLayerSecretArn:SecretString:LambdaLayerSecretArn}}'
```
* When the Layer ARN is directly given as plain text in the .yaml file, there is no issue.

Contributor guide

Open the contributing guide

Research direction

Start with the deploy-serverless command and the serverless.yaml Layer configuration, then trace how a Secrets Manager dynamic reference is handled during updates to an existing Lambda function. Reproduce consecutive layer updates with both the dynamic reference and a plain ARN. Done means the existing function receives the latest layer version when the ARN comes from Secrets Manager.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.