-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sam build very slow #3371
Comments
@GuilhermeCunha Thanks for raising the issue. We will try to reproduce the issue and investigate. |
Hi, sam build or sam build --cache extremely slow. Thank you very much! |
I was able to build the project in 52 seconds. From the logs you shared, it seems most of the time is always taken in the copy source step.
Could you please check that there is no not required files in your lambda functions source directories. |
I'm running into this as well. This only happens if my makefile is in the root of my project, if it's in a subdirectory, the makefile finishes in seconds. Maybe it's copying node_modules when it doesn't need to, which makes it take so much longer than it needs to? EDIT: I believe this can be solved by implementing something along the lines of what is in here: |
@moelasmar For JavaScript project, copy is slow due to large npm dependency even if there is no not required files in source directories |
Hi all, I think problems arises because sam tries to copy the whole project directory into a working dir for each lambda in the project. In my use case it seems way too much, since I have a directory structure like this:
Is there a way to tell sam not to consider other parts of the project? |
sam build seems to be unsustainable for large projects. Every time I build (even using
|
Thanks for raising this issue. SAM CLI now supports Please let us know if you have any improvement point for Thanks! |
@mndeveci we also originally planned to use esbuild, but with esbuild we couldn't ship other extensions to the build folder and that where makefile worked, we are also facing a big pause in builds, and one more thing we are on m1 chips. |
Thanks for the feedback @intrealm, I will take this to our team and PM to find a resolution for build's IO operations. |
For what it's worth, our build of eight functions sped up from 55 minutes to 2 minutes when we upgraded to sam 1.56.0. For us I think it was related to the bloat of devDependencies, which sam/esbuild now knows to omit. |
Description:
As can be seen in the logs below, this build took more than 10 minutes, as I only have 2 functions. I noticed that the "CustomMakeBuilder:CopySource" step takes too long, and I can't find an explanation to justify it.
I'm using a custom build for my project which is in Typescript, and the link to the repository can be found here.
Steps to reproduce:
Clone
Do configuration steps
Do build steps
Observed result:
Expected result:
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version
: SAM CLI, version 1.33.0The text was updated successfully, but these errors were encountered: