Hello team, I have added my domain to Route 53 in ...
# help
r
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
can I see your stacks code where you are configuring this
r
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
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
I actually did try it same issue happened Should I try deleting existing records in route 53 and try again?
t
Try it with the hostedZone: "text-shot.com" and tell me what error you get
r
On it
b
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
^ 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
Noice, what if I want
<http://mydomain.com|mydomain.com>
should I still specify hosted zone?
b
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
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
It's OK if your domain is in a registrar but you should point nameservers to AWS
r
Yeah, that’s why created hosted zone to get dns config.
t
I would say you should actually make the zone
<http://boxitoff.com|boxitoff.com>
b
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
Me too. Very weird.
Update: @thdxr Thanks in console, couldn’t find any issues. Looks like it is working! you are amazing!