When I set up a custom domain for my API, I didn't...
# help
j
When I set up a custom domain for my API, I didn't initially set a path, and now I want to. However, I'm reading in the docs that "Note, if the 
path
 was not defined initially, it cannot be defined later... Instead, you'd need to remove the 
customDomain
 option from the construct, deploy it." I've tried this and it doesn't seem to add it. Is there something specific that needs to happen to be able to add a path to a custom domain when it wasn't defined previously?
f
Hey @Joshua Oransky, can I see how you are defining the
customDomain
?
j
@Frank Here you go...
Copy code
this.api = new sst.Api(this, "Api", {
  customDomain: {
      domainName: `${URL_STAGE}<http://api.florango.io|api.florango.io>`,
      path: '2021-12-30',
  },
  hostedZone: '<http://florango.io|florango.io>',
  //...
t
Did you try deploying it once after you removed it?
j
Yeah. And I was only deploying it without the path defined before. What’s the reason behind the docs saying that it can't be defined later if it wasn't at first?
f
Can you try this: 1. Removing the entire
customDomain
block in ur code
Copy code
this.api = new sst.Api(this, "Api", {
//  customDomain: {
//      domainName: `${URL_STAGE}<http://api.florango.io|api.florango.io>`,
//      path: '2021-12-30',
//  },
2. Deploy 3. After the app deploys successfully, uncomment the
customDomain
and deploy again
To add some context, you’d need to remove the custom domain setup first, AND THEN add it back again with a path.
^^ as a side note,
hostedZone
should be configured as a part of
customDomain
j
@Frank thanks for the tip! I'll give it a try and report back.
f
Yup let me know 👍
j
@Frank so I tried your suggestion, but I still don't see any path added. Does it need to be actually fully deployed? And where would the path be defined? As part of the API or within the hosted zone?
Ok... so weirdly it seems to be all working now... I can now even add, remove, and change the path without redeploying. Thanks for the help, and I'll respond back if anything changes.