"sam build" causes "sam deploy" to create a deployment package even if nothing changed, for functions with dependencies
See original GitHub issue#1387 # Description
If I have a SAM template with multiple python functions, each in its own folder, and one of the functions has dependencies listed in requirements.txt, after issuing “sam build”, even if nothing changed in the template, function code, or dependencies, “sam deploy” will upload a new package, which takes time.
Steps to reproduce
- create a project with two functions, each in its own folder.
- for one of the functions add a dependency in requirements.txt (e.g., x-ray)
- run “sam build”
- run “sam deploy”
- run “sam build” again, without making any changes.
- run “sam deploy again”
Observed result
The function that contains dependencies, and the template, are packaged and uploaded, like this:
Initiating deployment
File with same data is already exists at serverless-scheduler/985973fbd971e45a959e6d520b75dfe1. Skipping upload File with same data is already exists at serverless-scheduler/6d9fba98bc2a080b3ec43a4921f5d0a9. Skipping upload Uploading to serverless-scheduler/8a441f7496a766afaf6cf4cf86407263 7460512 / 7460512.0 (100.00%) Uploading to serverless-scheduler/7a235e33ae6c1ab803faf9b9d3230e56.template 3220 / 3220.0 (100.00%)
Expected result
I would expect the “run deploy” to not do anything, like the following which happens if I ran “sam deploy” immediately after “sam deploy”: Initiating deployment
File with same data is already exists at serverless-scheduler/985973fbd971e45a959e6d520b75dfe1. Skipping upload File with same data is already exists at serverless-scheduler/6d9fba98bc2a080b3ec43a4921f5d0a9. Skipping upload File with same data is already exists at serverless-scheduler/bd363502c619e8fd70fb4b59c0e90e91. Skipping upload File with same data is already exists at serverless-scheduler/5a9cfd304a71aea5caa2a6298a2ceddb.template. Skipping upload
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
- OS: MacOS
sam --version
: SAM CLI, version 0.40.0
Add --debug flag to command you are running
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
I’m still having the issue in version
1.53.0
. I have nearly 50 lambda functions and SAM cli tries to upload the build 50 times.@deltafactory I think it’ll have to do the build in order to get the checksum that verifies the contents to upload are the same as the destination. The only part of this process that is skipped (I assume) is the actual transmission of the full built package, it will still have to communicate with the destination to get the ETag or whatever it uses to compare checksums and it will need a locally built version to generate the checksum to compare with.