With this customDomain setup, my app deployment ha...
# help
a
With this customDomain setup, my app deployment hangs after deploying the Api Stack:
Copy code
customDomain:
         app.stage === "prod" ? {
            isExternalDomain: true,
            domainName: "<http://api.mydomain.com|api.mydomain.com>",
            cdk: {
               certificate: new Certificate(stack, "apicert", {
                  domainName: "<http://api.mydomain.com|api.mydomain.com>",
                  validation: CertificateValidation.fromDns(),
               }),
            },
         } : undefined,
I already checked in ACM, there is nothing in there
there's also nothing in API Gateway under custom domain names
t
If it's an external domain dns validation probably isn't the right option.
AWS can't automatically create the DNS records for you
Although I do wonder why there's nothing in ACM
a
so how do I then set up an external domain properly? Do I have to create a certificate manually in the aws console?
the ApiStack is still CREATE_IN_PROGRESS in CloudFormation console
t
can you look through the events in the cfn console and see if there's more specific info?
usually there's something
f
@Adrian Schweizer for external domain, you’d have to 1. create the certificate in ACM manually (and validate it) 2. deploy the SST app (the customDomain config you shared above looks good) 3. create the DNS record manually in the DNS provider
That said, even if u didn’t do 1, CloudFormation shouldn’t get stuck.
Did you get pass that?
a
no, I couldn't get the api stack deployed correctly, it was hanging in CREATE_IN PROGRESS in Cloudformation
it is SST 1.1.0 btw, a fresh install and I copied my code over and used the migration guide to migrate it over to the new functional constructs
actually 1.1.1 according to package.json
If I try to deploy again now, I get the error:
❌  prod-bowhunter-ApiStack failed: Error: Stack prod-bowhunter-ApiStack is in the CREATE_IN_PROGRESS state. It cannot be deployed.
@thdxr I see nothing special. This is an event concerning the cert, but there are no errors, just a whole lot of CREATE_IN_PROGRESS events:
Copy code
022-05-18 14:53:07 UTC+0200	apicert7D2D58A1	
CREATE_IN_PROGRESS	Content of DNS Record is: {Name: _7d872058e47039ff8b47e4649214897a.api.bowhunter.app.,Type: CNAME,Value: _3da0365e462db303ed21884122575bfd.nhsllhhtvj.acm-validations.aws.}
last event in api stack is this:
Copy code
2022-05-18 14:52:16 UTC+0200	prod-bowhunter-ApiStack	
REVIEW_IN_PROGRESS	User Initiated
I deleted the stack manually in cloudformation console and am now trying another sst deploy operation
still the same problem
I'm now gonna try manually creating and validating the certificate in ACM console, then do
Copy code
Certificate.fromCertificateArn(this, "MyCert", certArn)
instead of new Certificate
Seems to work this way, at least it doesn't hang anymore on deploying the apistack
Hmmm, it worked for the API stack, but in the ReactStaticSite stack i now get the following error:
Error: Distribution certificates must be in the us-east-1 region and the certificate you provided is in eu-central-1.
Ah, seems to be a stupid AWS limitation
t
oh yeah this is a nightmare
in this situation I Just manually create the cert in the aws console and import it
it's not ideal but it's a constraint if you don't let route53 manage your domain
a
I got it to work with a second certificate in the us-east-1 region
any idea how I can output the internal aws url for the react static site distribution when I use an external domain? I now only see my custom domain as siteUrl and have to go hunting the internal one to set up the cname for through aws console
same question for the APIEndpoint
t
Copy code
stack.addOutput({ url: api.url })
a
great thx
I had a site.customDomainUrl || site.url in the API 😅
t
haha been there