Still trying to finish the guide. After adding a c...
# sst
d
Still trying to finish the guide. After adding a custom domain and deploying to production, I can’t restart SST. Error in thread
Copy code
-
I called the
frontend
from the guide
app
in this example
g
your api domain and app is it the same?
d
It is the same hostedzone
-
But the thing is that it works in production but not for my
daniel
stage
API:
Copy code
customDomain: {
        hostedZone: '<http://xx.io|xx.io>',
        domainName:
          scope.stage === 'prod'
            ? '<http://api.xx.io|api.xx.io>'
            : `${scope.stage}.<http://api.xx.io|api.xx.io>`,
      },
ReactStatucSite:
Copy code
customDomain: {
        domainName:
          scope.stage === 'prod'
            ? '<http://app.xx.io|app.xx.io>'
            : `${scope.stage}.<http://app.xx.io|app.xx.io>`,
        hostedZone: '<http://xx.io|xx.io>',
      },
If I give to customDomain a string with my subdomain (as per the guide) I get
[Error at /daniel-xxx-api/Api] Found zones: [] for dns:<http://api.xxx.io|api.xxx.io>, privateZone:undefined, vpcId:undefined, but wanted exactly 1 zone
t
This is a common CDK issue you can get into, has to do with removing a dependency between stacks
If this is for sst start I'd recommend just deleting the stacks and starting over
If it's for sst deploy you can selectively deploy the stack listed in the error message with
--stage
and that should fix it
d
when you say “remove the stacks” you mean going into cloud formation and removing them manually?
t
yeah
d
When I do sst start with the stage foo, I get a bunch of stacks named foo-appname-stackname
When I do sst deploy --stage foo I get those same stacks named the same way
If my understanding is correct, the stacks generated by start and deploy are different (as the start has the lambda websocket thingy)
So I’m not sure if deploy --stage will fix my foo stage or override it with the wrong code
t
Yeah it will fix your issue and also set your lambdas to not run in local mode
but then the next
sst start
should fix it
Sorry I meant to say
sst deploy --stack <stack in error message>
You have to manually tell CDK to deploy the stacks in the opposite order - it's not smart enough to figure that out
d
Is the issue the fact that “changing the API custom domain” requires to rebuild the API Because some service (in my case the ReactSite) depends on it and therefore CDK can’t delete the API?
t
CDK is not good about updating stacks in the reverse order when a stack removes a dependency
SO you get stuck in this situation and have to manually update one stack