https://serverless-stack.com/ logo
#sst
Title
# sst
r

Roger Rajaratnam

04/04/2022, 4:30 PM
When using the StaticSite construct, how can I set a domain alias for an externally hosted domain?
Copy code
$ /home/runner/work/sourcier-web/sourcier-web/node_modules/.bin/sst deploy --stage main
10
Using stage: main
11
Preparing your SST app
12

13
Error: Domain alias is only supported for domains hosted on Amazon Route 53. Do not set the "customDomain.domainAlias" when "isExternalDomain" is enabled.
14
    at StaticSite.validateCustomDomainSettings (/home/runner/work/sourcier-web/sourcier-web/node_modules/@serverless-stack/resources/src/StaticSite.ts:482:15)
15
    at new StaticSite (/home/runner/work/sourcier-web/sourcier-web/node_modules/@serverless-stack/resources/src/StaticSite.ts:92:10)
16
    at new GatsbyStack (/home/runner/work/sourcier-web/sourcier-web/libs/sst/src/lib/GatsbyStack.ts:30:18)
17
    at Object.main (/home/runner/work/sourcier-web/sourcier-web/libs/sst/src/index.ts:5:3)
18
    at Object.<anonymous> (/home/runner/work/sourcier-web/sourcier-web/.build/run.js:94:16)
19
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
20
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
21
    at Module.load (internal/modules/cjs/loader.js:950:32)
22
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
23
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12)
l

Lukasz K

04/05/2022, 1:29 PM
If I remember correctly you have a field in
customDomain
called
isExternalDomain
. Tho I have a vague memory that you need to set up a certificate manually first
f

Frank

04/06/2022, 4:16 PM
Thanks @Lukasz K!
@Roger Rajaratnam it’s pretty tricky to do with external domain. Is moving the DNS to Route 53 an option for you?
If not, you can move specific subdomains over i think.
r

Roger Rajaratnam

04/06/2022, 4:38 PM
I got it to work fine without the domain alias, I thought that was required to redirect www -> non www.
I did the redirect on via gandi.net where my domain is registered.