Skip to content

Conversation

zelch
Copy link

@zelch zelch commented Oct 28, 2022

This PR does two things.

The first (and less significant) change is that it replaces the static list of standard providers, and uses a runtime variable to add the enabled parameter to functions in whatever the current provider is.

The second change extends the plugin to allow it to disable events as well as functions.

Critically, the keyword for disabling events is 'disabled: true' not 'enabled: false', this is because 'enabled' already exists for some AWS event types. (sqs has it, sns does not)

Zeph / Liz Loss-Cutler-Hull added 2 commits October 28, 2022 01:19
This replaces the list of standard providers with a reference to
serverless.service.provider.name, which by the time we run is populated
with the current provider.
This allows us to remove events from functions in the same way that we
can currently remove functions, with the very notable change that the
keyword that we look for is 'disabled' instead of 'enabled'.

We do this because in the AWS provider, the 'enabled' keyword already
exists for some event types, with an existing meaning.
@zelch
Copy link
Author

zelch commented Nov 3, 2022

@abemedia Any thoughts?

@abemedia
Copy link
Owner

abemedia commented Nov 3, 2022

Hi @zelch, thanks for the PR.
This looks great, however since it's a breaking change it probably needs a major version bump. Will merge it in shortly but think it needs a big notice about upgrading on the readme before releasing.

@zelch
Copy link
Author

zelch commented Nov 3, 2022

@abemedia I'm reasonably sure that this should not break any existing users, but I could definitely be mistaken.

What did I miss that makes this a breaking change? :)

@abemedia
Copy link
Owner

abemedia commented Nov 4, 2022

Ah sorry didn't realise you also left the old syntax working. Just flew over it before.

@zelch
Copy link
Author

zelch commented Nov 4, 2022

@abemedia No worries, perhaps I should improve the readme a little bit.

The new syntax disabled: true can only be used for events, while the existing syntax enabled: false can only be used for entire functions.

This is due to conflicts on the enabled keyword in AWS events, and not wanting to risk any new conflicts with functions on any providers.

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