Skip to content

Commit

Permalink
fix(apigateway): set authorization scope when authorization type is C…
Browse files Browse the repository at this point in the history
…ognito (#30035)

### Issue # (if applicable)

Closes #29781

### Reason for this change

Authorization scope is set even when the auth type is None. This will cause deployment failure 
>12:52:11 PM | CREATE_FAILED | AWS::ApiGateway::Method | ActionsApiGatewayI...oxyOPTIONS041B022A
Resource handler returned message: "Invalid Method authorization type specified. Authorization Scopes are only valid for COGNITO_USER_POOLS authorization type (Servic
e: ApiGateway, Status Code: 400, Request ID: f9c6357b-428e-42a8-884c-07b77939d165)" (RequestToken: bb8de2e9-37b7-ca15-9bd8-547bc7eea134, HandlerErrorCode: InvalidRequ
est)

### Description of changes

Check when auth type is not Cognito, set auth scope to none. Not a breaking change because original templates cannot deploy.

### Description of how you validated changes

All existing and new tests pass.

### Checklist
- [ ] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
GavinZZ authored May 10, 2024
1 parent 3e9e0a8 commit 38a2284
Show file tree
Hide file tree
Showing 13 changed files with 1,706 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import json

def handler(event, context):
print("Event: ", event)
return {
'statusCode': 200,
'body': json.dumps({'message': 'Hello from Lambda l2!'})
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 38a2284

Please sign in to comment.