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

Jack Fraser

04/29/2021, 5:28 PM
Is it possible to have a customDomain setup so it uses the [stage/prefix].apis.domain.com?
Copy code
customDomain: {
        domainName: "*.<http://apis.domain.com|apis.domain.com>",
would create ci.apis.domain.com or branch_name.apis.domain.com etc
f

Frank

04/29/2021, 5:30 PM
if the branch_name is exposed as an env var in ur CI, can u do something like this?
Copy code
domain: `${process.env.BRANCH_NAME}.<http://apis.domain.com|apis.domain.com>`
j

Jack Fraser

04/29/2021, 6:33 PM
thanks @Frank now getting "The certificate provided must be owned by the account creating the domain" when
customDomain: {
domainName:
${environment.id}.<http://api.domain.com|api.domain.com>
, hostedZone: "domain.com", path: "v2", certificate: Certificate.fromCertificateArn(this, "SstDentrCert", "arnawsacmus east 1[account_id]:certificate/[guid]"), },
f

Frank

04/29/2021, 7:53 PM
Is the certificate in a different AWS account?
j

Jack Fraser

04/29/2021, 9:50 PM
@Frank no not a different account, but different region. Switch to same region and got rid of that error now get
Copy code
Invalid domain name identifier specified (Service: AmazonApiGatewayV2; Status Code: 404; Error Code: NotFoundException;
if
customDomain.path="v2"
or
Copy code
An ApiMapping key may contain only letters, numbers anif d one of
if
customDomain.path="/v2"
Any pointers welcome!
f

Frank

04/29/2021, 11:43 PM
Have you tried it without specifying the
certificate
?
Copy code
customDomain: {
  domainName: `${environment.id}.<http://api.domain.com|api.domain.com>`,
  hostedZone: "<http://domain.com|domain.com>",
  path: "v2",
},
j

Jack Fraser

04/30/2021, 8:32 AM
Issue fixed Things to note for those having the issue: •
customDomain.domainName
has to be lowercase •
customDomain.path
should not contain
/
("/v2" will error, "v2" will work) •
customDomain.certificate
when using
Certificate.fromCertificateArn
the
certArn
of the certificate needs to be the same AWS region as the deployment target
f

Frank

04/30/2021, 6:23 PM
Thanks @Jack Fraser. Let me take a look at these issues, and see what SST can do to auto-detect them.
Quick up: added a
domainName
lowercase check in the new release v0.17.0