Skip to content
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): authorizer name is not optional #5731

Merged
merged 2 commits into from
Jan 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-apigateway/lib/authorizers/lambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface TokenAuthorizerProps {
/**
* An optional human friendly name for the authorizer. Note that, this is not the primary identifier of the authorizer.
*
* @default - none
* @default this.node.uniqueId
*/
readonly authorizerName?: string;

Expand Down Expand Up @@ -92,7 +92,7 @@ export class TokenAuthorizer extends Authorizer implements IAuthorizer {
const restApiId = Lazy.stringValue({ produce: () => this.restApiId });

const resource = new CfnAuthorizer(this, 'Resource', {
name: props.authorizerName,
name: props.authorizerName ?? this.node.uniqueId,
restApiId,
type: 'TOKEN',
authorizerUri: `arn:aws:apigateway:${Stack.of(this).region}:lambda:path/2015-03-31/functions/${props.handler.functionArn}/invocations`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
"MyAuthorizer6575980E": {
"Type": "AWS::ApiGateway::Authorizer",
"Properties": {
"Name": "TokenAuthorizerIAMRoleIntegMyAuthorizer1DFDE3B5",
"RestApiId": {
"Ref": "MyRestApi2D1F47A9"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@
"MyAuthorizer6575980E": {
"Type": "AWS::ApiGateway::Authorizer",
"Properties": {
"Name": "TokenAuthorizerIntegMyAuthorizer793B1D5F",
"RestApiId": {
"Ref": "MyRestApi2D1F47A9"
},
Expand Down