Skip to content
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

[Migrated] S3 triggers apply incorrectly with multiple stages using the same bucket #861

Closed
jneves opened this issue Feb 20, 2021 · 2 comments
Labels
auto-closed [Bot] Closed, details in comments no-activity [Bot] Closing soon if no new activity

Comments

@jneves
Copy link
Contributor

jneves commented Feb 20, 2021

Originally from: Miserlou/Zappa#2111 by arcadecoffee

Context

If multiple stages use the same S3 bucket and events but with different prefixes, deployments, undeployments, schedules apply the S3 bucket events incorrectly.

Expected Behavior

Each stage should be capable of deploying it's own triggers and underlying only its own triggers.

Actual Behavior

The first deployment works correctly but subsequent deployments do not add the events for those stages. Undeployment of any stage deletes all events if the missing events have been added manually.

Possible Fix

During deployment or undeployment, bucket notification configurations in place as identified by trigger id should be compared to desired state (current state plus or minus event in question) and resulting configuration applied to the bucket.

Steps to Reproduce

Using zappa_settings.json below:

  1. zappa deploy dev
  2. Note trigger on lambda and event on S3 bucket
  3. zappa deploy stage
  4. Note the lack of the trigger on lambda and event on S3 bucket

Your Environment

zappa_settings.json:

{
  "dev": {
    "app_function": "example.app",
    "aws_region": "us-east-1",
    "profile_name": "default",
    "project_name": "zappa-example",
    "runtime": "python3.7",
    "s3_bucket": "zappa-123456",
    "events": [
      {
        "function": "example.dev_app",
        "event_source": {
          "arn": "arn:aws:s3:::bucketname1234",
          "key_filters": [
            {
              "type": "prefix",
              "value": "dev"
            }
          ],
          "events": [
            "s3:ObjectCreated:*"
          ]
        }
      }
    ]
  },
  "stage": {
    "app_function": "example.app",
    "aws_region": "us-east-1",
    "profile_name": "default",
    "project_name": "zappa-example",
    "runtime": "python3.7",
    "s3_bucket": "zappa-123456",
    "events": [
      {
        "function": "example.stage_app",
        "event_source": {
          "arn": "arn:aws:s3:::bucketname1234",
          "key_filters": [
            {
              "type": "prefix",
              "value": "stage"
            }
          ],
          "events": [
            "s3:ObjectCreated:*"
          ]
        }
      }
    ]
  },
  "prod": {
    "app_function": "example.app",
    "aws_region": "us-east-1",
    "profile_name": "default",
    "project_name": "zappa-example",
    "runtime": "python3.7",
    "s3_bucket": "zappa-123456",
    "events": [
      {
        "function": "example.app",
        "event_source": {
          "arn": "arn:aws:s3:::bucketname1234",
          "key_filters": [
            {
              "type": "prefix",
              "value": "prod"
            }
          ],
          "events": [
            "s3:ObjectCreated:*"
          ]
        }
      }
    ]
  }
}
Copy link

github-actions bot commented Apr 3, 2024

Hi there! Unfortunately, this Issue has not seen any activity for at least 90 days. If the Issue is still relevant to the latest version of Zappa, please comment within the next 10 days if you wish to keep it open. Otherwise, it will be automatically closed.

@github-actions github-actions bot added the no-activity [Bot] Closing soon if no new activity label Apr 3, 2024
Copy link

Hi there! Unfortunately, this Issue was automatically closed as it had not seen any activity in at least 100 days. If the Issue is still relevant to the latest version of Zappa, please open a new Issue.

@github-actions github-actions bot added the auto-closed [Bot] Closed, details in comments label Apr 13, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-closed [Bot] Closed, details in comments no-activity [Bot] Closing soon if no new activity
Projects
None yet
Development

No branches or pull requests

1 participant