message: fix(serverless-component): create the DNS record only when hosted zone exists
diff: @@ -129,6 +129,7 @@ class Domain extends Component {
  this.context.debug(
  `Configuring DNS for distribution "${subdomain.url}".`
  );
  + if (domainHostedZoneId) {
  await configureDnsForCloudFrontDistribution(
  clients.route53,
  subdomain,
  @@ -137,6 +138,11 @@ class Domain extends Component {
  inputs.domainType,
  this
  );
  + } else {
  + this.context.debug(
  + `DNS records for domain ${subdomain.domain} were not configured because the domain was not found in your account. Please configure the DNS records manually`
  + );
  + }
  } else if (subdomain.type === "awsAppSync") {
  throw new Error(`Unsupported subdomain type ${awsS3Website}`);
  }
  @@ -191,6 +197,7 @@ class Domain extends Component {
  );
  await removeDomainFromCloudFrontDistribution(clients.cf, domainState);
  + if (domainHostedZoneId) {
  this.context.debug(
  `Removing CloudFront DNS records for domain ${domainState.domain}`
  );
  @@ -200,6 +207,11 @@ class Domain extends Component {
  domainHostedZoneId,
  domainState.url.replace("https://", "")
  );
  + } else {
  + this.context.debug(
  + `Could not remove the DNS records for domain ${domainState.domain} because the domain was not found in your account. Please remove the DNS records manually`
  + );
  + }
  } else if (domainState.type === "awsAppSync") {
  this.context.debug(`Unsupported subdomain type ${awsS3Website}`);
  }
  