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

CfnAuthorizer: name is required by CloudFormation #5678

Closed
thantos opened this issue Jan 7, 2020 · 3 comments · Fixed by #5731
Closed

CfnAuthorizer: name is required by CloudFormation #5678

thantos opened this issue Jan 7, 2020 · 3 comments · Fixed by #5731
Assignees
Labels
@aws-cdk/aws-apigateway Related to Amazon API Gateway bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@thantos
Copy link
Contributor

thantos commented Jan 7, 2020

CDK type CfnAuthorizer's name property is optional, but stack deployment fails when omitted. On adding a name, the deployment succeeded.

cdk: https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-apigateway.CfnAuthorizer.html
cfn: https://docs.aws.amazon.com/apigateway/api-reference/resource/authorizer/

Reproduction Steps

    const authorizer = new CfnAuthorizer(this, 'authorizer', {
      restApiId: coreApi.restApiId,
      type: "TOKEN",
      identitySource: "method.request.header.Authorization",
      authorizerResultTtlInSeconds: 300,
      authorizerUri: `arn:aws:apigateway:${this.region}:lambda:path/2015-03-31/functions/${authorizerFunction.functionArn}/invocations`,
      authorizerCredentials: authorizerRole.roleArn,
      //name: "authorizer"
    });

Error Log

 4/9 | 12:00:58 AM | CREATE_FAILED        | AWS::ApiGateway::Authorizer   | authorizer 1 validation error detected: Value null at 'createAuthorizerInput.name' failed to satisfy constraint: Member must not be null (Service: AmazonApiGateway; Status Code: 400; Error Code: ValidationException; Request ID: 2f1b2889-cda1-499f-831e-527c8695128f)

Environment

  • CLI Version : 1.19.0 (build 5597bbe)
  • Framework Version: v12.14.0
  • OS : Windows 10
  • Language : Typescript

Other

After adding a name...

 4/9 | 12:05:33 AM | CREATE_COMPLETE      | AWS::ApiGateway::Authorizer   | authorizer

This is 🐛 Bug Report

@thantos thantos added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 7, 2020
@netroy
Copy link
Contributor

netroy commented Jan 7, 2020

From the API docs, looks like name is required when creating new Authorizers
v1 docs & v2 docs

Perhaps the Cloudformation docs are incorrect?

@nija-at
Copy link
Contributor

nija-at commented Jan 8, 2020

Internal reference: issues/CFN-30099

nija-at pushed a commit that referenced this issue Jan 9, 2020
The authorizer name property is marked as optional in CloudFormation
docs but is actually not.

Use the TokenAuthorizer node's uniquId as the default.

fixes #5678
@mergify mergify bot closed this as completed in #5731 Jan 9, 2020
mergify bot added a commit that referenced this issue Jan 9, 2020
The authorizer name property is marked as optional in CloudFormation
docs but is actually not.

Use the TokenAuthorizer node's uniquId as the default.

fixes #5678

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
charlesguse added a commit to charlesguse/aws-cloudformation-user-guide that referenced this issue Dec 7, 2020
The docs show Name as optional. When trying to leave name out, CloudFormation gives the error "1 validation error detected: Value null at 'createAuthorizerInput.name' failed to satisfy constraint: Member must not be null"

We can see a thread in the aws-cdk that tackles this topic for the CDK docs specifically.
aws/aws-cdk#5678
aws/aws-cdk@4c1db33
@radarcg
Copy link

radarcg commented Sep 8, 2021

This seems to be an issue again in the 2.0 CDK library, I just ran into this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-apigateway Related to Amazon API Gateway bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants