I’m trying to use the StateSite construct but I’m ...
# help
n
I’m trying to use the StateSite construct but I’m not understanding how to tell it to deploy to a subdomain on my hosted zone. I tried
customDomain: "<http://mySubDomain.myDomain.com|mySubDomain.myDomain.com>"
but it’s erroring out saying it can’t find the hosted zone:
<http://mySubDomain.myDomain.com|mySubDomain.myDomain.com>
This is probably something simple that I’m just not understanding
Do I need to provide the hostedZone property explicitly and then it’ll be able to figure it out.
f
Hey @Nick Laffey, yup correct.
Without expplicitly providing a hostedzone,
StaticSite
will try to look for the one that matches the domain name.
Something like this:
Copy code
new StaticSite(this, "Site", {
  path: "path/to/src",
  customDomain: {
    domainName: "<http://mySubDomain.myDomain.com|mySubDomain.myDomain.com>",
    hostedZone: "<http://myDomain.com|myDomain.com>",
  },
});
Here are some more examples on configuring the custom domain https://docs.serverless-stack.com/constructs/StaticSite#using-the-full-config
n
Got it, thanks for confirming!