Skip to content

🐛 Fix rollback for slim_handler by using versioned archive paths#1438

Open
monkut wants to merge 1 commit intomasterfrom
bug/1383-slim-handler-rollback
Open

🐛 Fix rollback for slim_handler by using versioned archive paths#1438
monkut wants to merge 1 commit intomasterfrom
bug/1383-slim-handler-rollback

Conversation

@monkut
Copy link
Copy Markdown
Collaborator

@monkut monkut commented Mar 11, 2026

Summary

Fixes #1383

  • ARCHIVE_PATH was hardcoded to {stage}_{project}_current_project.tar.gz, a fixed S3 key overwritten on every deploy
  • On rollback, the old handler zip still pointed to this "current" archive, loading the latest app code instead of the version-matched code
  • Now embeds the timestamped archive filename (e.g., myapp-1709876543.tar.gz) in ARCHIVE_PATH — each Lambda version references its own immutable archive on S3
  • The _current_project.tar.gz copy is still created for backwards compatibility with existing deployments

How 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

  • Full test suite passes (271 tests, 2 pre-existing websocket flakes)
  • Verified get_zappa_settings_string() generates versioned path from self.zip_path
  • Manual testing: deploy with slim_handler=True, update, then rollback to verify correct version loads

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.
@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 73.963% (-0.06%) from 74.02%
when pulling e746720 on bug/1383-slim-handler-rollback
into 0c76f11 on master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rollback doesn't work for project with Slim Handler

3 participants