-
Notifications
You must be signed in to change notification settings - Fork 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
fix(apigateway): authorizerUri does not resolve to the correct partition #8152
Conversation
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
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.
Thanks for making these changes.
A couple of things need to be added here -
-
This also needs to be fixed in
RequestAuthorizer
here -authorizerUri: `arn:aws:apigateway:${Stack.of(this).region}:lambda:path/2015-03-31/functions/${props.handler.functionArn}/invocations`, -
Update the assertions on the unit tests to verify that the ARN is as expected. Update here -
expect(stack).to(haveResource('AWS::ApiGateway::Authorizer', { expect(stack).to(haveResource('AWS::ApiGateway::Authorizer', { AuthorizerUri
property to thehaveResource
method.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Hi nija-at, Thank you for the feedback. I have updated the commit accordingly :) |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
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.
Mostly there. Just one more comment to fix up.
/** | ||
* constructs the authorizerURIArn. | ||
*/ | ||
protected authorizerURIArn() { | ||
return `arn:${Stack.of(this).partition}:apigateway:${Stack.of(this).region}:lambda:path/2015-03-31/functions/${this.handler.functionArn}/invocations`; | ||
} |
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.
This will export this API as part of this module's public API. That is not necessary here.
Instead, make this a standalone function at the bottom of the file.
function lambdaAuthorizerArn(handler: Function) {
return `arn:${Stack.of(handler).partition}:apigateway:${Stack.of(handler).region}:lambda:path/2015-03-31/functions/${handler.functionArn}/invocations`;
}
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
I have added the changes :) |
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.
Looks like there is another failing integration test. Please take a look and apply a fix.
The authorizerURI includes the correct partition. Previously, it always used the aws partition fixes #<8098>
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Add that the authorizerURI includes the correct partition. Previously, it
always used the aws partition.
fixes #8098
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license