Amplify CLI Performance Issues (#current-cloud-backend.zip contains node_modules)
How did you install the Amplify CLI?
npm install -g @aws-amplify/cli
If applicable, what version of Node.js are you using?
18.16.1
Amplify CLI Version
12.3.0
What operating system are you using?
Windows
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No manual changes.
Describe the bug
We have performance problems with our Amplify project with the cli. e.g. the amplify checkout takes almost 30 minutes.
I'm trying to isolate the problem right now. maybe it has multiple causes. But I noticed that the #current-cloud-backend.zip file also contains the node modules.
During checkout, this file is downloaded and unpacked. however, because of the node modules 40,000 files are included, the unpacking also takes a relatively long time.
With Lambda Function resources the node_modules are not included in the zip. But with Lambda Layers the node_modules are included in the zip.
Is this on purpose? I suspect that this is a bug?
Expected behavior
in my opinion the node_modules shouldn't be part of this zip file
Reproduction steps
- amplify init
- amplify add function
- add an layer
- npm init on the "opt" folder
- npm install
- amplify push
Project Identifier
No response
Log output
# Put your logs below this line
Additional information
No response
Before submitting, please confirm:
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.
Hey @StefanVolkmer-WW, thank you for reaching out. This is currently the expected behaviour, the shared code or assets such as node_modules are zipped into the current_cloud_backend.zip. Please refer to https://docs.amplify.aws/cli/function/layers/#add-shared-code--assets providing this information and https://github.com/aws-amplify/amplify-cli/blob/dev/packages/amplify-category-function/src/provider-utils/awscloudformation/utils/packageLayer.ts file that packages the layer.
I wanted to follow-up here and see if you require any additional information on this.
Closing due to inactivity
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.