hello there. I have the following react website st...
# help
c
hello there. I have the following react website stack:
Copy code
export default class Website extends Stack {
  constructor(scope, id, props) {
    super(scope, id, props);

    const tld = process.env.TLD

    const { url } = new ReactStaticSite(this, "website", {
      path: "app",
      environment: {
        REACT_APP_API_GATEWAY_URL: props.apiUrl,
      },
      customDomain: scope.stage === 'live'
        ? tld
        : `${scope.stage}.${tld}`
    });

    // Show the URLs in the output
    this.addOutputs({
      SiteUrl: url,
    });
  }
}
where I want to use a new domain for each deployed stage I have. does SST creates the domain automatically if it doesn’t exist? or do I have to create it and then pass it to the ReactStaticSite component? because with that code I’m getting the error:
Copy code
[Error at /mystack/website] Found zones: [] for dns:<http://undefined.mytld.com|undefined.mytld.com>, privateZone:undefined, vpcId:undefined, but wanted exactly 1 zone
f
Hey @Carlos Daniel try setting the hosted zone, ie.
Copy code
customDomain: {
  hostedZone: tld,
  domainName: scope.stage === 'live'
        ? tld
        : `${scope.stage}.${tld}`
}
c
that worked, thanks!