aws-amplify / aws-amplify/amplify-cli
Unable to update Lambda Layer permissions
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 825
- Avg merge
- 11d 23h
- Merged PRs (30d)
- 2
Description
### Before opening, please confirm:
- [X] I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-cli/issues?q=is%3Aissue+).
- [X] I have read the guide for [submitting bug reports](https://github.com/aws-amplify/amplify-cli/blob/master/CONTRIBUTING.md#bug-reports).
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
### How did you install the Amplify CLI?
pnpm add -g @aws-amplify/cli
### If applicable, what version of Node.js are you using?
v16.13.0
### Amplify CLI Version
7.3.3
### What operating system are you using?
Mac
### Amplify Categories
function
### Amplify Commands
update
### Describe the bug
After upgrading the CLI to the latest version (7.3.3), I am unable to update lambda layer permissions from a layer created with a previous version of the CLI (6.3.1)
A few observation notes:
- layers created with latest version are _able_ to be updated with latest version
- layers created with 6.3.1 are _unable_ to be updated with 6.3.1
- layers created with 6.4.0 are _unable_ to be updated with 6.4.0
### Expected behavior
CLI should update the layer accordingly
### Reproduction steps
1. using Amplify CLI v6.3.1, create a lambda layer:
```
> amplify add function
⚠️ Amplify command hooks are disabled in the current execution environment.
⚠️ See https://docs.amplify.aws/cli/usage/command-hooks/ for more information.
? Select which capability you want to add: Lambda layer (shared code & resource used across functions)
? Provide a name for your Lambda layer: layer2465d15f
? Choose the runtime that you want to use: NodeJS
? The current AWS account will always have access to this layer.
Optionally, configure who else can access this layer. (Hit to skip) Public
✅ Lambda layer folders & files created:
amplify/backend/function/8525layerslayer2465d15f
Next steps:
Move your libraries to the following folder:
[NodeJS]: amplify/backend/function/8525layerslayer2465d15f/lib/nodejs
Include any files you want to share across runtimes in this folder:
amplify/backend/function/8525layerslayer2465d15f/opt
"amplify function update " - configure a function with this Lambda layer
"amplify push" - builds all of your local backend resources and provisions them in the cloud
```
2. Push new layer `amplify push -y`
3. Upgrade to latest version of CLI `pnpm add -g @aws-amplify/cli@latest`
4. Attempt to update lambda layer permissions
```
> amplify update function
⚠️ Amplify command hooks are disabled in the current execution environment.
⚠️ See https://docs.amplify.aws/cli/usage/command-hooks/ for more information.
? Do you want to adjust layer version permissions? Yes
? Select the layer version to update: Future layer versions
? The current AWS account will always have access to this layer.
Optionally, configure who else can access this layer. (Hit to skip) Specific AWS accounts, Public
? Provide a list of comma-separated AWS account IDs: xxxxxxxx
```
5. Observe CLI exits with no clear indication of failed or successful update, running `amplify status -v` shows no changes
```
> amplify status -v
⚠️ Amplify command hooks are disabled in the current execution environment.
⚠️ See https://docs.amplify.aws/cli/usage/command-hooks/ for more information.
Current Environment: dev
┌──────────┬─────────────────────────┬───────────┬───────────────────┐
│ Category │ Resource name │ Operation │ Provider plugin │
├──────────┼─────────────────────────┼───────────┼───────────────────┤
│ Function │ 8525layerslayer2465d15f │ No Change │ awscloudformation │
└──────────┴─────────────────────────┴───────────┴───────────────────┘
```
### GraphQL schema(s)
```graphql
# Put schemas below this line
```
### Log output
```
# Put your logs below this line
```
### Additional information
_No response_
Contributor guide
Research direction
Start by reproducing the issue with Amplify CLI versions 6.3.1, 6.4.0, and 7.3.3 using `amplify add function`, `amplify push -y`, and `amplify update function`. Compare the generated layer permission state and command behavior; done means permissions for a layer created by an older CLI version update successfully and `amplify status -v` reflects the expected result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, node.js, typescript
- Domain
- authorization, cli, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100