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

Rohith Gilla

05/04/2022, 1:53 PM
Hello team, I have added my domain to Route 53 in a hosted zone. For testing I have deployed once in testing and it worked but from next deploy getting this error.
Copy code
It seems you are configuring custom domains for you URL. And SST is not able to find the hosted zone "<http://app-serverless-cli.text-shot.com|app-serverless-cli.text-shot.com>" in your AWS Route 53 account. Please double check and make sure the zone exists, or pass in a different zone.
I tried deleting
npx sst remove — stage  {my stage name}
but still same issues.
t

thdxr

05/04/2022, 1:54 PM
can I see your stacks code where you are configuring this
r

Rohith Gilla

05/04/2022, 1:55 PM
Thanks @thdxr
Copy code
const api = new sst.Api(this, "Api", {
      defaultFunctionProps: {
        environment: {
          TWITTER_BEARER_TOKEN: process.env.TWITTER_BEARER_TOKEN ?? "",
        },
      },
      routes: {
        "GET /": {
          function: {
            handler: "src/lambda.handler",
            //timeout in seconds
            timeout: 15,
            //Loading additional layers,
            layers: [layer],
            // Exclude bundling it in the Lambda function
            bundle: { externalModules: ["chrome-aws-lambda"] },
          },
        },
      },
      customDomain: `api-${scope.stage}.<http://text-shot.com|text-shot.com>`,
    });

    const frontend = new sst.NextjsSite(this, "Frontend", {
      path: "frontend",
      environment: {
        TWITTER_BEARER_TOKEN: process.env.TWITTER_BEARER_TOKEN ?? "",
        API_ENDPOINT: api.url,
      },
      customDomain:
        scope.stage === "prod"
          ? "<http://text-shot.com|text-shot.com>"
          : `app-${scope.stage}.<http://text-shot.com|text-shot.com>`,
    });
If it helps Route 53 console
It would be great if I can know the reason and potential fix too Would be writing a blog posts about it so want to make sure I cover things 😅
t

thdxr

05/04/2022, 3:44 PM
So you need to also specify zone with custom domain since your zone is at
<http://text-shot.com|text-shot.com>
you don't need path
r

Rohith Gilla

05/04/2022, 3:48 PM
I actually did try it same issue happened Should I try deleting existing records in route 53 and try again?
t

thdxr

05/04/2022, 3:49 PM
Try it with the hostedZone: "text-shot.com" and tell me what error you get
r

Rohith Gilla

05/04/2022, 3:56 PM
On it
b

Bala Chalasani

05/04/2022, 3:57 PM
I just configured this with the hostedZone option and it works a treat.
Copy code
customDomain: {
    domainName: `notes-api-${scope.stage}.<http://selflearning.com|selflearning.com>`,
    hostedZone: `notes-api-${scope.stage}.<http://selflearning.com|selflearning.com>`
},
t

thdxr

05/04/2022, 3:57 PM
^ you only need to specify hosted zone if you have a different zone than the domain name
typically you'll have a zone for
<http://mydomain.com|mydomain.com>
and want domains at
<http://stage1.mydomain.com|stage1.mydomain.com>
r

Rohith Gilla

05/04/2022, 3:58 PM
Noice, what if I want
<http://mydomain.com|mydomain.com>
should I still specify hosted zone?
b

Bala Chalasani

05/04/2022, 4:00 PM
thanks @thdxr in my case the domain was on Godaddy, I pointed the subdomain to Route53 using NS records and created a hosted zone for the subdomain on Route53. Then used the hostedZone option to specify the subdomain
r

Rohith Gilla

05/04/2022, 4:01 PM
Same my case domain is in namecheap 😛 I’ll keep you updated about the deploy that I am doing using
Try it with the hostedZone: “text-shot.com” and tell me what error you get
t

thdxr

05/04/2022, 4:01 PM
It's OK if your domain is in a registrar but you should point nameservers to AWS
r

Rohith Gilla

05/04/2022, 4:02 PM
Yeah, that’s why created hosted zone to get dns config.
t

thdxr

05/04/2022, 4:03 PM
I would say you should actually make the zone
<http://boxitoff.com|boxitoff.com>
b

Bala Chalasani

05/04/2022, 4:06 PM
yes ideally, it is a pain if we already have DNS being managed elsewhere, and only want to use AWS for the subdomain, just pointing to Route53 for the subdomain does the trick
I am still not sure how it worked the first time around for @Rohith Gilla
r

Rohith Gilla

05/04/2022, 4:09 PM
Me too. Very weird.
Update: @thdxr Thanks in console, couldn’t find any issues. Looks like it is working! you are amazing!
5 Views