amplify-cli icon indicating copy to clipboard operation
amplify-cli copied to clipboard

Amplify CLI Performance Issues (#current-cloud-backend.zip contains node_modules)

Open Stefan-WW opened this issue 3 years ago • 4 comments

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

  1. amplify init
  2. amplify add function
  3. add an layer
  4. npm init on the "opt" folder
  5. npm install
  6. 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.

Stefan-WW avatar Aug 31 '23 16:08 Stefan-WW

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.

ykethan avatar Sep 01 '23 15:09 ykethan

I wanted to follow-up here and see if you require any additional information on this.

ykethan avatar Sep 13 '23 14:09 ykethan

Closing due to inactivity

josefaidt avatar Oct 02 '23 17:10 josefaidt

⚠️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.

github-actions[bot] avatar Oct 02 '23 17:10 github-actions[bot]