question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

hostedZoneNameServers can be undefined in PublicHostedZone

See original GitHub issue

Reproduction Steps

Using Route53 > PublicHostedZone.hostedZoneNameServers.

Unfortunatly, I can’t export these NS as a CfnOutput because hostedZoneNameServers can be undifiened (why ? I’m using PublicHostedZone) : Type 'undefined' is not assignable to type 'string'

And I have to set NS as records in another account (who drive the Main Public HostedZone).

So, is it a bug for the PublicHostedZone ? And of course, can’t write the output in a file (with CDK –outputs-file) to use it in my other Account.

So, what can I do ?

Thanks in advance.

Environment

  • CLI Version : CDK 1.42.1 (build a4797b4)
  • Framework Version: 6.14.5
  • Node.js Version: v12.15.0
  • OS : Linux
  • Language (Version): TypeScript

Other


This is 🐛 Bug Report

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
shivlakscommented, Jun 5, 2020

@Cloudrage PublicHostedZone implements IHostedZone which represents the properties for all hosted zones. The reason the property may be undefined is because any hosted zone should be usable in an API that accepts IHostedZone.

Can you share the code that you’re trying to write and use. Assuming it was defined, you’re still attempting to assign a list of strings to the value property to your output which only allows type string.

something like the following is what you’d want to do - sketch

const hostedZone = new r53.HostedZone(this, 'my-hosted-zone', {
  zoneName: 'www.shivexample.com',
});

if (hostedZone.hostedZoneNameServers) {
  new cdk.CfnOutput(this, 'MyOutput', {
    value: Fn.join(',', hostedZone.hostedZoneNameServers),
  });
}

let me know how it goes!

0reactions
Cloudragecommented, Jun 8, 2020

Yes you’re right ! It’s working with your proposal; many thanks.

So, now to be perfect, we need to have the capability to get CloudFormation Outputs between accounts; because actually, I’ve to get the output from a file in the Repo. So it means that the “Builder” (another one than me) have to launch CDK with the correct option (that implies that the entire code can’t be valid until prerequisites resources & outputs are created. So, some snippets have to be comment…).

Read more comments on GitHub >

github_iconTop Results From Across the Web

class PublicHostedZone (construct) · AWS CDK
Returns the set of name servers for the specific hosted zone. For example: ns1.example.com. This attribute will be undefined for private hosted zones...
Read more >
AWS CDK -- How do I retrieve my NS Records from my newly ...
There is a hostedZoneNameServers property on the zone object. ... This attribute will be undefined for private hosted zones or hosted zones ...
Read more >
awsroute53 - Go Packages
func NewPublicHostedZone_Override(p PublicHostedZone, scope constructs. ... This attribute will be undefined for private hosted zones or ...
Read more >
Package Diff: @aws-cdk/aws-route53 @ 0.31.0 .. 0.32.0
export declare class PublicHostedZone extends HostedZone implements IPublicHostedZone { ... You can. * associated additional VPCs using `addVpc(vpc)`.
Read more >
Creating a Route 53 Public Hosted Zone with a reusable ...
However: each time you re-create a Route 53 hosted zone, the DNS nameservers allocated will change. If you're using CloudFormation to manage ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found