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

Allow multiple ARNs for a single event definition #1461

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jnhmcknight
Copy link
Contributor

Description

There was a bug with AWS event source handling when trying to setup triggers on the same function from multiple events. Only 1 of the events would be setup. In the original setup, the following zappa_settings.json would result in the behaviour described:

{
    "prod": {
        "s3_bucket": "my-zappa-packages",
        "role_name": "my-zappa-role",
        "cloudwatch_log_level": "ERROR",
        "events": [
            {
                "function": "my_app.handle_my_trigger",
                "event_source": {
                    "arn": "arn:aws:s3:::my-first-bucket",
                    "events": [
                        "s3:ObjectCreated:*"
                    ]
                }
            },
            {
                "function": "my_app.handle_my_trigger",
                "event_source": {
                    "arn": "arn:aws:s3:::my-second-bucket",
                    "events": [
                        "s3:ObjectCreated:*"
                    ]
                }
            },
            {
                "function": "my_app.handle_my_trigger",
                "event_source": {
                    "arn": "arn:aws:s3:::my-third-bucket",
                    "events": [
                        "s3:ObjectCreated:*"
                    ]
                }
            }
        ]
    }
}

Whereas, with these changes, the following settings work as expected, setting up the event source triggers on each of the buckets in question:

{
    "prod": {
        "s3_bucket": "my-zappa-packages",
        "role_name": "my-zappa-role",
        "cloudwatch_log_level": "ERROR",
        "events": [
            {
                "function": "my_app.handle_my_trigger",
                "event_source": {
                    "arn": [
                        "arn:aws:s3:::my-first-bucket",
                        "arn:aws:s3:::my-second-bucket",
                        "arn:aws:s3:::my-third-bucket"
                    ],
                    "events": [
                        "s3:ObjectCreated:*"
                    ]
                }
            }
        ]
    }
}

@coveralls
Copy link

coveralls commented Mar 27, 2018

Coverage Status

Coverage decreased (-0.1%) to 74.225% when pulling 2715047 on jnhmcknight:multi-event-source into 7d38c15 on Miserlou: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.

2 participants