-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add validation for S3 NotificationConfiguration in Serverless Functin… #2473
Add validation for S3 NotificationConfiguration in Serverless Functin… #2473
Conversation
@@ -407,13 +407,16 @@ def _inject_notification_configuration(self, function, bucket): | |||
notification_config = {} | |||
properties["NotificationConfiguration"] = notification_config | |||
|
|||
if not isinstance(notification_config, dict): | |||
raise InvalidResourceException(bucket_id, "Invalid type for NotificationConfiguration. Must be a dict.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is dict
the right wording here? I only ask because dict
is pretty Python specific. How does CloudFormation communicate things like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CloudFormation doesn't seem have a generic name for an object/dict (e.g. it's called NotificationConfiguration
type for this case).
Instead of "dict", I think we can just say "Invalid type for NotificationConfiguration". I think it's informative enough for customer to find out how to fix it.
Codecov Report
@@ Coverage Diff @@
## develop #2473 +/- ##
===========================================
+ Coverage 93.58% 94.49% +0.90%
===========================================
Files 90 98 +8
Lines 6124 7299 +1175
Branches 1260 1523 +263
===========================================
+ Hits 5731 6897 +1166
- Misses 183 194 +11
+ Partials 210 208 -2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Issue #, if available:
N/A/
Description of changes:
Add Validation for
NotifcationConfiguration
in a S3 Bucket if it is used in a Serverless Function as an event source.Description of how you validated changes:
Updated test to catch this error.
Checklist:
make pr
passesExamples?
Please reach out in the comments, if you want to add an example. Examples will be
added to
sam init
through https://github.com/awslabs/aws-sam-cli-app-templates/By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.