Zappa icon indicating copy to clipboard operation
Zappa copied to clipboard

Deploying a Zappa project invoked using S3 events, reverts any EventBridge configuration for a given S3 bucket

Open Sam152 opened this issue 3 years ago • 2 comments

Context

  • I've deployed a zappa project which is invoked by an S3 event. When it's deployed, it creates a record under the "Event notifications" section of the S3 bucket.
  • I've previously configured (via CDK) that the bucket should "Send notifications to Amazon EventBridge for all events in this bucket".

Expected Behavior

  • Deploying the project should retain the existing EventBridge configuration.

Actual Behavior

  • When the Zappa lambda is deployed, the EventBridge configuration is reverted to "Off".

Possible Fix

Steps to Reproduce

  1. Create a project with the following configuration:
    "events": [
      {
        "function": "function_name",
        "event_source": {
          "arn": "arn:aws:s3:::BUCKET-NAME",
          "events": [
            "s3:ObjectCreated:*"
          ],
        }
      }
    ]
  1. Enable EventBridge integration for the bucket:
Screen Shot 2022-09-21 at 8 58 53 am
  1. Deploy the Zappa project and observe the integration has been turned off.

Sam152 avatar Sep 21 '22 00:09 Sam152

Here's the related code where zappa schedules events: https://github.com/zappa/Zappa/blob/master/zappa/core.py#L2775

zappa uses kappa to update the s3 event source. I suspect the unschedule remove() action may be removing the notification configuration.

However, I wonder if this is just a cosmetic issue on aws's side.
I have seen issues with triggers defined by zappa or cfn files that don't show in the console, but function as expected.

Do S3 notifications still work with the target bucket?

monkut avatar Sep 22 '22 00:09 monkut

Not in this case, no. Once the EventBridge integration reflects as "Off" in the UI, events are no longer delivered to EventBridge.

Sam152 avatar Sep 22 '22 01:09 Sam152

Revisiting this, I haven't tested it, but I also wonder if other "Event notifications" would also be removed when deploying a zappa project.

Sam152 avatar Oct 05 '22 02:10 Sam152

The easiest workaround we could implement in zappa is to provide a flag to ignore redeploying events.

In your case, I would use zappa for packaging and separate deployment.

I'd like to see a point where zappa has a more clearly separated deployment/packaging integration, where zappa generates the cloudformation templates that you could edit if necessary, then the zappa deployment commands just wrap the related cloudformation calls.

monkut avatar Oct 26 '22 02:10 monkut

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[bot] avatar Apr 03 '24 18:04 github-actions[bot]

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[bot] avatar Apr 13 '24 20:04 github-actions[bot]