-
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 sync
with typescript not updating Lambda layer code in Lambda function
#7322
Comments
Thanks for creating the issue, and preparing example repo for re-producing the problem. Due to the nature of This is my updated template.yaml file;
And I can get the
However, when you remove the Layer, it might still not work since the layer contents and function contents are different folderes.
Please let us know if you have other questions or issues. |
I'm not sure I understand. In the sample I shared I am in-fact offloading shared dependencies into a layer - which is working as expected. The bug is that during In addition, if I'm not misstaken the change you suggest would mean that every function is re-built every time a change happens in one function. With your suggestion, my file structure would be
In my template, if I set
Wouldn't that trigger all Lambdas to update if I update the code for one function? |
I just verified that is the case. I have 7 lambda function (and using the structure I mentioned in the previous message), and with the change you suggested each Lambda function is re-built during a This is not desirable and greatly impacts the development experience. The sync now takes 7x longer, since I have 7 Lambda functions. |
Would appreciate some guidance here. Given the feedback from the CLI when using |
What I was trying to say, esbuild bundles everything into single package, therefore you don't need to use layers anymore. Can you try to remove the layer and do |
Closing due to inactivity |
|
Description
When using
sam sync
for updating a Lambda Layer written in typescript, the change is not reflected in the imported code in the lambda function.Referencing a LambdaLayer in a Lambda function, I'm expecting the lambda function to use the updated layer during invocation. This is the observed bahaviour using python, but when using a Typescript layer together with
sam sync
, the change is not propagated to the live function, despite the SAM cli feedback indicating it has:SAM template:
Steps to reproduce
(If you don't want to set it up from scratch, you can clone this repo, where I've done the below steps)
sam init
with a typescript hello world example.npm install
inside the hello-world function diretory to install esbuildsam build --build-in-source && sam deploy
in the rootsam sync --code --watch --build-in-source
in the root.If we now make an update to the lambda function, the correct and latest layer code is used.
Observed result
Updating the Lambda layer, SAM cli syncs the layer and reports that the sync was sucessfull. Inspecting the Lambda function in the console, I also see that the layer version has been bumped. Invoking the lambda function, however, is using the old layer code.
Expected result
The latest layer code to be used.
Additional environment details
sam --version
: 1.108.0The text was updated successfully, but these errors were encountered: