aws / aws/aws-sam-cli

Bug: `sam sync --watch` doesn't work for layers because LogicalResourceId changes on each build

Open
#6,391 2 comments 0 reactions 0 assignees View on GitHub
area/sync stage/bug-repro
Dominant language
Python
Stars
6.7k
Forks
1.2k
Avg merge
1d 10h
Merged PRs (30d)
52

Description

### Description:
When using `sam sync --watch`, layers will not update because a layer's LogicalResourceId changes on each build/upload. Thus, when the layer is "updated" due to the watch, other functions will still be pointed at the original layer LogicalResourceId. I do not know of a way to specify a layer's LogicalResourceId.

### Steps to reproduce:
1. Create lambda function reliant on a layer
2. Run `sam sync --watch`
3. Update layer and wait for redeploy
4. Note that update does not take effect until the watch is killed and re-run

### Observed result:
No update to function's layer output

### Expected result:
Update to function's layer output

### Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

```
{
"version": "1.94.0",
"system": {
"python": "3.8.13",
"os": "macOS-13.2.1-arm64-arm-64bit"
},
"additional_dependencies": {
"docker_engine": "20.10.20",
"aws_cdk": "Not available",
"terraform": "Not available"
},
"available_beta_feature_env_vars": [
"SAM_CLI_BETA_FEATURES",
"SAM_CLI_BETA_BUILD_PERFORMANCE",
"SAM_CLI_BETA_TERRAFORM_SUPPORT",
"SAM_CLI_BETA_RUST_CARGO_LAMBDA"
]
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.