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

(aws-route53-targets): Cannot use SpecRestApi to create ApiGateway target for ARecord #16227

Closed
AlexStasko opened this issue Aug 25, 2021 · 2 comments · Fixed by #16610
Closed
Assignees
Labels
@aws-cdk/aws-apigateway Related to Amazon API Gateway @aws-cdk/aws-route53-targets bug This issue is a bug. effort/small Small work item – less than a day of effort good first issue Related to contributions. See CONTRIBUTING.md p1

Comments

@AlexStasko
Copy link

I'm trying to use the SpecRestApi to create API Gateway based on the OpenAPI document. To have the ability to use Custom Domain Name I need to create ARecord, but RecordTarget.fromAlias(new ApiGateway(apiGW)) accepts only RestApi class.

image

Reproduction Steps

Code snipet:

    const apiGW = new SpecRestApi(this, 'RestApi', {
      apiDefinition: ApiDefinition.fromAsset('open-api.yaml'),
    });
    const record = new ARecord(this, 'Record', {
      zone: HostedZone.fromHostedZoneAttributes(this, 'Route53HostedZone', {
        zoneName: dnsZoneName,
        hostedZoneId: dnsHostedZoneId,
      }),
      target: RecordTarget.fromAlias(new ApiGateway(apiGW)),
    });

What did you expect to happen?

I'm able to create ARecord with SpecRestApi

What actually happened?

The compiler shows me error Argument of type 'SpecRestApi' is not assignable to parameter of type 'RestApi'.

Environment

  • CDK CLI Version : 1.119.0
  • Framework Version: 1.119.0
  • Node.js Version: 14.17.0
  • OS : Ubuntu
  • Language (Version): TypeScript (4.3.5)

Other

Suggestion for fix:
on this line need to change apig.RestApi to apig.RestApiBase


This is 🐛 Bug Report

@AlexStasko AlexStasko added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Aug 25, 2021
@njlynch njlynch added effort/small Small work item – less than a day of effort p1 and removed needs-triage This issue or PR still needs to be triaged. labels Sep 10, 2021
@njlynch njlynch removed their assignment Sep 10, 2021
@njlynch
Copy link
Contributor

njlynch commented Sep 10, 2021

Thanks for the report, @AlexStasko !

I agree with your suggested fix. In addition, we should add a test to the corresponding test file with a test case using a SpecRestApi.

Given the traction this has already gotten, I'm marking this as a p1. We welcome community contributions! If you are able, we encourage you to contribute.

@njlynch njlynch added the good first issue Related to contributions. See CONTRIBUTING.md label Sep 10, 2021
@mergify mergify bot closed this as completed in #16610 Sep 23, 2021
mergify bot pushed a commit that referenced this issue Sep 23, 2021
Closes #16227.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

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 @aws-cdk/aws-route53-targets bug This issue is a bug. effort/small Small work item – less than a day of effort good first issue Related to contributions. See CONTRIBUTING.md p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants