🐛 Fix rollback for slim_handler by using versioned archive paths#1438
Open
🐛 Fix rollback for slim_handler by using versioned archive paths#1438
Conversation
ARCHIVE_PATH in the handler settings was hardcoded to a fixed "current_project" S3 key that gets overwritten on each deploy. On rollback, the old handler zip still referenced the latest archive, causing version mismatch. Now embeds the timestamped archive filename (already uploaded to S3) in ARCHIVE_PATH so each Lambda version references its own project archive. The "current_project" S3 copy is retained for backwards compatibility.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1383
ARCHIVE_PATHwas hardcoded to{stage}_{project}_current_project.tar.gz, a fixed S3 key overwritten on every deploymyapp-1709876543.tar.gz) inARCHIVE_PATH— each Lambda version references its own immutable archive on S3_current_project.tar.gzcopy is still created for backwards compatibility with existing deploymentsHow it works
Before: Every handler zip contained
ARCHIVE_PATH='s3://bucket/stage_app_current_project.tar.gz'After: Each handler zip contains
ARCHIVE_PATH='s3://bucket/myapp-1709876543.tar.gz'(unique per deploy)On rollback, Lambda restores the old handler zip which now correctly references its own timestamped archive.
Test plan
get_zappa_settings_string()generates versioned path fromself.zip_pathslim_handler=True, update, then rollback to verify correct version loads