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
Handle when function http event auth is not a string #2234
Conversation
cee5633
to
e0c2acb
Compare
e0c2acb
to
75417b2
Compare
Codecov Report
@@ Coverage Diff @@
## develop #2234 +/- ##
===========================================
+ Coverage 93.58% 94.54% +0.96%
===========================================
Files 90 95 +5
Lines 6124 6568 +444
Branches 1260 1323 +63
===========================================
+ Hits 5731 6210 +479
+ Misses 183 166 -17
+ Partials 210 192 -18
Continue to review full report at Codecov.
|
@@ -1219,6 +1219,11 @@ def _add_auth_to_openapi_integration(self, api, editor): | |||
"an explicit 'Authorizer' set or a 'DefaultAuthorizer' " | |||
"configured on the HttpApi.", | |||
) | |||
elif not isinstance(method_authorizer, string_types): |
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.
method_authorizer
might have been updated in the preceding if
... do we know that DefaultAuthorizer
is a string (was that previously checked?). If not, we could consider turning this into an if
rather than elif
.
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.
Good call, DefaultAuthorizer
being a dict should not produce this error message (instead, it has its own message). Fixed. I also added an extra unit test to ensure only DefaultAuthorizer
related error message is generated when it happens.
75417b2
to
3bb1633
Compare
Issue #, if available:
Description of changes:
Description of how you validated changes:
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.