Updating amplify meta major performance issue #13814
Labels
feature-request
Request a new feature
ops-deploy
Operational theme: push and deployment
platform-push
Issues related to `amplify push`
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
18.7.1
Amplify CLI Version
12.12.1
What operating system are you using?
Mac
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No manual changes made
Describe the bug
The "store current cloud backend" step is extremely slow for larger code bases due to some inefficient code in the CLI. For larger projects this step can take several minutes to complete, in our case this step can take more than 15 minutes to complete.
The cause of this issue is found in the
update-amplify-meta.ts
file, in themoveBackendResourcesToCurrentCloudBackend
function. During this step, ALL files from amplify resource folders are copied into the current cloud backend target directory (including node_modules, which in the case of functions with a lot of dependencies can potentially be a very large folder containing many files). After the copying the files over, a check is made to see if any node_modules were copied over (using glob.sync) after which they are deleted.This is incredibly inefficient. Especially for larger projects this will drastically slow down deploy times.
Problematic code:
Expected behavior
Storing current cloud backend shouldn't take more than 15 minutes.
Reproduction steps
Project Identifier
No response
Log output
Additional information
No response
Before submitting, please confirm:
The text was updated successfully, but these errors were encountered: