-
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
Stop Sam Local from rebuilding layers on every invoke #3725
Comments
Thanks for bringing this to our attention! Tagging this as a feature request because it seems like there's a couple of ways to not build on every invoke (using eager warm containers or publishing the layer and referencing the ARN: #3725). To make sure I understand, is this feature request for only building layers when changes are detected? |
@torresxb1 - yes that's correct a request to only rebuild layers when changes are detected to the layer. At least in my workflow the layers change very infrequently compared to the lambda source (and it by far takes the longest to build) so rebuilding each time really slows down the dev experience. You're correct there are workaround as mentioned but both of them have downsides I tried to call out. So I think it would greatly help speed local dev (when using layers) if this was improved. Finally, and this may just be my lack of understanding but why do they layers have to be rebuilt at all by the running process? When we make code changes to the lambda we need to run Thanks! |
Does using eager warm containers actually work? I just tried the switch and get errors. |
+1 |
+1 |
--warm-containers=EAGER doesn't really do the job, as soon as the function code is changed from that point onwards the layer is built on each request. |
This is indeed very annoying. I have my node_modules in a layer and I rarely make any change to them but I have to wait a very long time on each lambda source code change to invoke it. |
+1 |
2 similar comments
+1 |
+1 |
@torresxb1 any updates on this or if it can be implemented. It seems this is effecting quite a few devs. It really slows down process. |
just came across this. current behaviour sucks. |
@praneetap - is there a list of features somewhere being worked by sam accelerate team? This feature seems to be pretty highly requested and it is brutal to use sam local for dev if the layers keep rebuilding. Nearly all the issues i find related to sam and slowness is related to inefficient layer handling. |
+1 |
+1 |
sam local start-api --debug --warm-containers LAZY --skip-pull-image It resolved the issue |
Currently it seems that
sam local start-api
will build any lambda layers on every request. This ends up creating a very slow dev experience.Since
sam build
seems to be able to determine if a layer changes or not the local api behaviour not just assume the layer hasn't changed. If it does changesam build
will rebuild it anyway?it seems like passing the
--warm-containers=EAGER
as mentioned in this thread: Envek/aws-sam-typescript-layers-example#11 (comment) stops the layers from building each time but this isn't really a nice solution since a lot of times during testing I want to just test a single lambda I don't want to have to wait for all the lambda's to build layers again (each time I make a change to the code).Is there another option I'm missing?
The text was updated successfully, but these errors were encountered: