aws-amplify / aws-amplify/amplify-cli

amplify env checkout causes local changes to lambda layer

Open
#8,216 24 comments 14 reactions 0 assignees View on GitHub
feature-request functions ops-multienv p3 strategic
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?

npm

### If applicable, what version of Node.js are you using?

_No response_

### Amplify CLI Version

6.0.0

### What operating system are you using?

Mac

### Amplify Categories

function

### Amplify Commands

env

### Describe the bug

Whenever I switch between environments using `amplify env checkout X` that have a lambda layer, there are changes made to the awscloudformation-template.json and parameters.json for the layer.

parameters.json

awscloudformation-template.json

### Expected behavior

`amplify env checkout X` should not result in any changes to files that are git committed.

### Reproduction steps

I'm not clear yet whether this is expected or not - happy to try to reproduce further if useful.

I have one lambda function, with one lambda layer.

backend-config.json:
```
"function": {
"LambdaWithLayer8ba9f268": {
"service": "Lambda",
"providerPlugin": "awscloudformation",
"build": true,
"dependsOn": [
{
"category": "function",
"resourceName": "LambdaLayer",
"attributes": [
"Arn"
]
}
]
},
"LambdaLayer": {
"providerPlugin": "awscloudformation",
"service": "LambdaLayer",
"build": true
}
},
```

function parameters.json:
```
{
"lambdaLayers": [
{
"type": "ProjectLayer",
"resourceName": "LambdaLayer",
"env": "dev",
"version": "Always choose latest version",
"isLatestVersionSelected": true
}
]
}
```

### Log output

```
# Put your logs below this line

```

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.