Carlos Daniel
04/18/2022, 4:34 PMexport 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:
[Error at /mystack/website] Found zones: [] for dns:<http://undefined.mytld.com|undefined.mytld.com>, privateZone:undefined, vpcId:undefined, but wanted exactly 1 zone
Frank
customDomain: {
hostedZone: tld,
domainName: scope.stage === 'live'
? tld
: `${scope.stage}.${tld}`
}
Carlos Daniel
04/18/2022, 5:02 PM