amplify-cli: amplify env checkout causes local changes to lambda layer
Before opening, please confirm:
- I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
- I have searched for duplicate or closed issues.
- I have read the guide for submitting bug reports.
- 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.
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
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 14
- Comments: 22 (3 by maintainers)
We have encountered the same issue and the function parameters.json changes make us fairly distressed. Using the example above:
Specifically:
"env": "dev",This file is supposed to environment agnostic, is my understanding. It feels wrong to commit this value and share it with my team/go to prod with it. Would my production functions be referencing layers in dev due to this configuration?
We are seeing the same behavior as well. Another problem that this issue causes is that if your Cloud Formation stack has to be rolled back for any reason, it will fail due to this.
Just ran into this same issue, I’m using the AWS OpenTelemetry lambda layer for nodejs. Every time I checkout a new environment, it deletes the lambda layer from
function-parameters.json+1 - Any update on this?
+1. Yet another annoying feature of Amplify. Using CLI 11.0.3.
same problem here
Any news on this? This issue is causing confusion on our multienv/multibranch development flow.
Same problem of @arbieo here too. It is very annoying to have this modified all the time.
+1. Same problem of @arbieo. Diffs between
devandprodbranches for the lambda layerenv, consequently brings to merging problemsHi, I noticed the same behavior on my side, it’s annoying since I need to push new lambda layer versions each time, even if I did not updated them.
It only happens when changing environment.