Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix lambda version generation when only function config changes #4510
What did you implement:
There is a bug in the lambda version creation. Currently only the ZIP file hash is used to
This leads to a bug, because if you now deploy, the function is deployed as $LATEST, but no
Only if you do source changes, a new version will be created.
The bug gets visible and breaks your deployments, if you rely on the last version instead
How did you implement it:
I added the function configuration to the hash used for generating the logical id
Additionally I switched to reading the ZIP asynchronously (we should not use synchronous functions at all) in chunks to comply with Node so that the Node event loop is not unnecessarily stalled during this lengthy operation. This also lowers the memory footprint to a minimum and is much faster - to generate the hashes it is unnecessary to read the whole file at once!
A deployment creates this version:
After change of an environment variable in the function configuration. Notice, that
As you see, although the code hash (zip file) stays the same, the version
Now the last Lambda version will resemble the last changed version. If you deploy
How can we verify it:
Deploy any service. Open one of the service's functions in the AWS Lambda console and check the generated version (it should be of the same configuration as the $LATEST version).
Now change something in the configuration of the function, but leave its sources untouched.
I tested it with multiple of our complex projects and the version creation worked as expected.
Is this ready for review?: YES