When using a custom domain and trying a prod deplo...
# help
j
When using a custom domain and trying a prod deployment as shown on the sst guide here https://serverless-stack.com/chapters/custom-domains-in-serverless-apis.html it seems to fail to deploy the new prod-api. Has anyone else encountered this issue? My custom domain is hosted by route53
Copy code
customDomain:
  scope.stage === "prod" ? "<http://api.my-serverless-app.com|api.my-serverless-app.com>" : undefined,
n
Hey james, do you have any more info on the error you are seeing? I may have had a similar issue, my
customDomain
configuration also defines the hosted zone and path. Maybe try setting your
hostedZone
property - ignore path & apigatewaydomain stuff, that is just cuz i have a few apis hosted on the same domain with different paths
Copy code
customDomain: {
      domainName: apiGatewayDomain || `api.${PROD_URL}`,
      hostedZone: apiGatewayDomain ? undefined : PROD_URL,
      path: serviceName.toLowerCase(),
}
j
this is a bit of silly question but as an example what would you have defined as your
apiGatewayDomain ?
When doing the deployment the prod-api stack fails to deploy it just goes into a hanging deployment before cancelling out and then it does an automatic roll back
seems to struggle with the certificates?
in this context give me an example value for
apiGatewayDomain
and
serviceName
?
@Noah D
Copy code
✅ prod-myaddress-storage: No changes
⌛ prod-myaddress-api: Deploying...
09:28:32 | UPDATE_IN_PROGRESS | AWS::CloudFormation::Stack           | prod-myaddress-api
09:28:41 | CREATE_IN_PROGRESS | AWS::CertificateManager::Certificate | ApiCertificate285C31EB
09:28:42 | CREATE_IN_PROGRESS | AWS::CertificateManager::Certificate | ApiCertificate285C31EB
09:29:14 | CREATE_IN_PROGRESS | AWS::CertificateManager::Certificate | ApiCertificate285C31EB
These are the logs I am seeing on the Seed build
Trying to follow this guide but it is still not working for me https://serverless-stack.com/examples/how-to-add-a-custom-domain-to-a-serverless-api.html
n
Hey james, in the context of my example apiGatewayDomain is a property of the
sst.API
construct. For example
Copy code
this.myFirstApi = new sst.API(...)
this.mySecondApi = new sst.API(
  ...
  customDomain: {
    domainName: this.myFirstApi.apiGatewayDomain || `api.${PROD_URL}`,
    hostedZone: this.myFirstApi.apiGatewayDomain ? undefined : PROD_URL,
    path: 'my-second-api,
  }
)
Yours should probably look closer to this though
The apigatwatDomain stuff is more to do with the fact i have multiple paths on the same domain
Also regarding those logs, you don't have a specific failure message anywhere? does it just hang? And what do you get when you deploy locally?
Also are you sure you aren't already using your custom domain for a different environment? Might be conflicting
f
Hi @James, I second @Noah D here. Does your build eventually fail? ie.
Copy code
✅ prod-myaddress-storage: No changes
⌛ prod-myaddress-api: Deploying...
09:28:32 | UPDATE_IN_PROGRESS | AWS::CloudFormation::Stack           | prod-myaddress-api
09:28:41 | CREATE_IN_PROGRESS | AWS::CertificateManager::Certificate | ApiCertificate285C31EB
09:28:42 | CREATE_IN_PROGRESS | AWS::CertificateManager::Certificate | ApiCertificate285C31EB
09:29:14 | CREATE_IN_PROGRESS | AWS::CertificateManager::Certificate | ApiCertificate285C31EB
Do you see an error after this?
@James also, it could also be that the domain is hosted in Route53 of another account. Did you purchase the domain in this AWS account? Or was purchased in another account, or elsewhere like GoDaddy?
j
Hi @Frank thank you for your messages, the domain was originally hosted on GoDaddy but I did a transfer to Route53, I wonder if there is an extra step I need to do in order for the stack to deploy with the custom domain? I will share the error logs with your now...
Copy code
❌ prod-futurekick-api: Certificate is in PENDING_VALIDATION status
16:26:32 | UPDATE_IN_PROGRESS                           | AWS::CloudFormation::Stack           | prod-futurekick-api
16:26:41 | CREATE_IN_PROGRESS                           | AWS::CDK::Metadata                   | CDKMetadata
16:26:42 | UPDATE_IN_PROGRESS                           | AWS::Lambda::Function                | ApiLambdaDELETEnotesid69A96EAD
16:26:42 | UPDATE_IN_PROGRESS                           | AWS::Lambda::Function                | ApiLambdaGETnotesidBDFD7F2C
16:26:42 | UPDATE_IN_PROGRESS                           | AWS::Lambda::Function                | ApiLambdaPUTnotesid28D10C39
16:26:42 | CREATE_IN_PROGRESS                           | AWS::CDK::Metadata                   | CDKMetadata
16:26:43 | CREATE_COMPLETE                              | AWS::CDK::Metadata                   | CDKMetadata
16:26:43 | UPDATE_IN_PROGRESS                           | AWS::Lambda::Function                | ApiLambdaPOSTbilling71E49732
16:26:43 | CREATE_IN_PROGRESS                           | AWS::CertificateManager::Certificate | ApiCertificate285C31EB
16:26:43 | UPDATE_IN_PROGRESS                           | AWS::Lambda::Function                | ApiLambdaGETnotesA3E56CF7
16:26:43 | CREATE_IN_PROGRESS                           | AWS::CertificateManager::Certificate | ApiCertificate285C31EB
16:26:44 | UPDATE_IN_PROGRESS                           | AWS::Lambda::Function                | ApiLambdaPOSTnotes3B067E1B
16:27:16 | CREATE_IN_PROGRESS                           | AWS::CertificateManager::Certificate | ApiCertificate285C31EB
16:27:19 | UPDATE_COMPLETE                              | AWS::Lambda::Function                | ApiLambdaPUTnotesid28D10C39
16:27:20 | UPDATE_COMPLETE                              | AWS::Lambda::Function                | ApiLambdaDELETEnotesid69A96EAD
16:27:21 | UPDATE_COMPLETE                              | AWS::Lambda::Function                | ApiLambdaGETnotesidBDFD7F2C
16:27:22 | UPDATE_COMPLETE                              | AWS::Lambda::Function                | ApiLambdaGETnotesA3E56CF7
16:27:24 | UPDATE_COMPLETE                              | AWS::Lambda::Function                | ApiLambdaPOSTbilling71E49732
16:27:25 | UPDATE_COMPLETE                              | AWS::Lambda::Function                | ApiLambdaPOSTnotes3B067E1B
04:31:10 | CREATE_FAILED                                | AWS::CertificateManager::Certificate | ApiCertificate285C31EB - Certificate is in PENDING_VALIDATION status
04:31:13 | UPDATE_ROLLBACK_IN_PROGRESS                  | AWS::CloudFormation::Stack           | prod-futurekick-api - The following resource(s) failed to create: [ApiCertificate285C31EB]. 
04:31:18 | UPDATE_IN_PROGRESS                           | AWS::Lambda::Function                | ApiLambdaPOSTnotes3B067E1B
04:31:19 | UPDATE_IN_PROGRESS                           | AWS::Lambda::Function                | ApiLambdaPOSTbilling71E49732
04:31:19 | UPDATE_IN_PROGRESS                           | AWS::Lambda::Function                | ApiLambdaGETnotesidBDFD7F2C
04:31:19 | UPDATE_IN_PROGRESS                           | AWS::Lambda::Function                | ApiLambdaGETnotesA3E56CF7
04:31:19 | UPDATE_IN_PROGRESS                           | AWS::Lambda::Function                | ApiLambdaPUTnotesid28D10C39
04:31:19 | UPDATE_IN_PROGRESS                           | AWS::Lambda::Function                | ApiLambdaDELETEnotesid69A96EAD
04:31:53 | UPDATE_COMPLETE                              | AWS::Lambda::Function                | ApiLambdaGETnotesidBDFD7F2C
04:31:55 | UPDATE_COMPLETE                              | AWS::Lambda::Function                | ApiLambdaPOSTbilling71E49732
04:31:57 | UPDATE_COMPLETE                              | AWS::Lambda::Function                | ApiLambdaPOSTnotes3B067E1B
04:31:57 | UPDATE_COMPLETE                              | AWS::Lambda::Function                | ApiLambdaDELETEnotesid69A96EAD
04:31:57 | UPDATE_COMPLETE                              | AWS::Lambda::Function                | ApiLambdaGETnotesA3E56CF7
04:31:58 | UPDATE_COMPLETE                              | AWS::Lambda::Function                | ApiLambdaPUTnotesid28D10C39
04:32:01 | UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS | AWS::CloudFormation::Stack           | prod-futurekick-api
04:32:02 | DELETE_IN_PROGRESS                           | AWS::CertificateManager::Certificate | ApiCertificate285C31EB
04:32:02 | DELETE_IN_PROGRESS                           | AWS::CDK::Metadata                   | CDKMetadata
04:32:03 | DELETE_COMPLETE                              | AWS::CDK::Metadata                   | CDKMetadata
Error logs from Seed pipeline above ^ and here is the overall error message
Do you think GoDaddy might be the issue?
Hi @Noah D thanks for the message, will look again at the guide but I have followed that bit of the guide quite a few times trying to resolve this... might look closer at the domain transfer bit since originally it was hosted on godaddy?
Do you know what the issue may be or is there anything else I can give you to help debug the issue?
@Frank do you know what might be causing the issue?
f
Thanks for the details @James. Can you do a dns lookup on ur domain and see if the DNS servers match those in ur Route 53, or do they still show GoDaddy?
You can run a dns check here https://mxtoolbox.com/DNSLookup.aspx
j
Your DNS hosting provider is "GoDaddy"
after checking with this link. Which is odd to me because when I check Route53 the Hosted Zone has my custom domain as the DNS name ? 🙃
f
Ah that makes sense. So after u setup Route 53, you need to update the name servers addresses for the domain in GoDaddy to point to Route 53.
j
Hey @Frank having read through that article it looks like this is for when you have not transferred the URL from GoDaddy to Route53 (which I have already done). You can see in my GoDaddy account that the DNS url is no longer there. My main question is when I do a SEED deploy is it hanging if I already have the DNS in route53 but it seems that it can not find it. I am now not sure if Godaddy is the issue if the Domain is now being managed by AWS?
@Noah D also apologies thought I replied to your comments. The build just hangs and then it eventually fails
Copy code
❌ prod-futurekick-api: Certificate is in PENDING_VALIDATION status
16:26:32 | UPDATE_IN_PROGRESS                           | AWS::CloudFormation::Stack           | prod-futurekick-api
16:26:41 | CREATE_IN_PROGRESS                           | AWS::CDK::Metadata                   | CDKMetadata
16:26:42 | UPDATE_IN_PROGRESS                           | AWS::Lambda::Function                | ApiLambdaDELETEnotesid69A96EAD
16:26:42 | UPDATE_IN_PROGRESS                           | AWS::Lambda::Function                | ApiLambdaGETnotesidBDFD7F2C
16:26:42 | UPDATE_IN_PROGRESS                           | AWS::Lambda::Function                | ApiLambdaPUTnotesid28D10C39
16:26:42 | CREATE_IN_PROGRESS                           | AWS::CDK::Metadata                   | CDKMetadata
16:26:43 | CREATE_COMPLETE                              | AWS::CDK::Metadata                   | CDKMetadata
16:26:43 | UPDATE_IN_PROGRESS                           | AWS::Lambda::Function                | ApiLambdaPOSTbilling71E49732
16:26:43 | CREATE_IN_PROGRESS                           | AWS::CertificateManager::Certificate | ApiCertificate285C31EB
16:26:43 | UPDATE_IN_PROGRESS                           | AWS::Lambda::Function                | ApiLambdaGETnotesA3E56CF7
16:26:43 | CREATE_IN_PROGRESS                           | AWS::CertificateManager::Certificate | ApiCertificate285C31EB
16:26:44 | UPDATE_IN_PROGRESS                           | AWS::Lambda::Function                | ApiLambdaPOSTnotes3B067E1B
16:27:16 | CREATE_IN_PROGRESS                           | AWS::CertificateManager::Certificate | ApiCertificate285C31EB
16:27:19 | UPDATE_COMPLETE                              | AWS::Lambda::Function                | ApiLambdaPUTnotesid28D10C39
16:27:20 | UPDATE_COMPLETE                              | AWS::Lambda::Function                | ApiLambdaDELETEnotesid69A96EAD
16:27:21 | UPDATE_COMPLETE                              | AWS::Lambda::Function                | ApiLambdaGETnotesidBDFD7F2C
16:27:22 | UPDATE_COMPLETE                              | AWS::Lambda::Function                | ApiLambdaGETnotesA3E56CF7
16:27:24 | UPDATE_COMPLETE                              | AWS::Lambda::Function                | ApiLambdaPOSTbilling71E49732
16:27:25 | UPDATE_COMPLETE                              | AWS::Lambda::Function                | ApiLambdaPOSTnotes3B067E1B
04:31:10 | CREATE_FAILED                                | AWS::CertificateManager::Certificate | ApiCertificate285C31EB - Certificate is in PENDING_VALIDATION status
04:31:13 | UPDATE_ROLLBACK_IN_PROGRESS                  | AWS::CloudFormation::Stack           | prod-futurekick-api - The following resource(s) failed to create: [ApiCertificate285C31EB]. 
04:31:18 | UPDATE_IN_PROGRESS                           | AWS::Lambda::Function                | ApiLambdaPOSTnotes3B067E1B
04:31:19 | UPDATE_IN_PROGRESS                           | AWS::Lambda::Function                | ApiLambdaPOSTbilling71E49732
04:31:19 | UPDATE_IN_PROGRESS                           | AWS::Lambda::Function                | ApiLambdaGETnotesidBDFD7F2C
04:31:19 | UPDATE_IN_PROGRESS                           | AWS::Lambda::Function                | ApiLambdaGETnotesA3E56CF7
04:31:19 | UPDATE_IN_PROGRESS                           | AWS::Lambda::Function                | ApiLambdaPUTnotesid28D10C39
04:31:19 | UPDATE_IN_PROGRESS                           | AWS::Lambda::Function                | ApiLambdaDELETEnotesid69A96EAD
04:31:53 | UPDATE_COMPLETE                              | AWS::Lambda::Function                | ApiLambdaGETnotesidBDFD7F2C
04:31:55 | UPDATE_COMPLETE                              | AWS::Lambda::Function                | ApiLambdaPOSTbilling71E49732
04:31:57 | UPDATE_COMPLETE                              | AWS::Lambda::Function                | ApiLambdaPOSTnotes3B067E1B
04:31:57 | UPDATE_COMPLETE                              | AWS::Lambda::Function                | ApiLambdaDELETEnotesid69A96EAD
04:31:57 | UPDATE_COMPLETE                              | AWS::Lambda::Function                | ApiLambdaGETnotesA3E56CF7
04:31:58 | UPDATE_COMPLETE                              | AWS::Lambda::Function                | ApiLambdaPUTnotesid28D10C39
04:32:01 | UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS | AWS::CloudFormation::Stack           | prod-futurekick-api
04:32:02 | DELETE_IN_PROGRESS                           | AWS::CertificateManager::Certificate | ApiCertificate285C31EB
04:32:02 | DELETE_IN_PROGRESS                           | AWS::CDK::Metadata                   | CDKMetadata
04:32:03 | DELETE_COMPLETE                              | AWS::CDK::Metadata                   | CDKMetadata
So not sure if this is an issue on how I transferred the domain from godaddy to route53 originally?
hmmm I wonder if this link is actually relevant to me
j
@Frank can we take a look at this when you get a chance?
j
Another thing to note the hosted zone id in cdk.context.json does match the hosted zone in route53
the only error message in the log that stands out is
prod-sitename-api: Certificate is in PENDING_VALIDATION status
This Certificate pending issue seems to have not occurred before in this slack group 🤨
My certificate is refusing to validate on Certificate Manager while the build is occurring on seed. It is a pending state and then it will timeout, I wonder why this is.... Looking at this https://aws.amazon.com/premiumsupport/knowledge-center/acm-certificate-pending-validation/
The build from Seed has been hanging for over 9 hours now
Copy code
⌛ prod-futurekick-api: Deploying...
20:55:33 | UPDATE_IN_PROGRESS | AWS::CloudFormation::Stack           | prod-futurekick-api
20:55:42 | CREATE_IN_PROGRESS | AWS::CDK::Metadata                   | CDKMetadata
20:55:43 | CREATE_IN_PROGRESS | AWS::CertificateManager::Certificate | ApiCertificate285C31EB
20:55:44 | UPDATE_IN_PROGRESS | AWS::Lambda::Function                | ApiLambdaDELETEnotesid69A96EAD
20:55:44 | UPDATE_IN_PROGRESS | AWS::Lambda::Function                | ApiLambdaGETnotesA3E56CF7
20:55:44 | CREATE_IN_PROGRESS | AWS::CertificateManager::Certificate | ApiCertificate285C31EB
20:55:44 | UPDATE_IN_PROGRESS | AWS::Lambda::Function                | ApiLambdaPUTnotesid28D10C39
20:55:44 | UPDATE_IN_PROGRESS | AWS::Lambda::Function                | ApiLambdaGETnotesidBDFD7F2C
20:55:44 | CREATE_IN_PROGRESS | AWS::CDK::Metadata                   | CDKMetadata
20:55:44 | UPDATE_IN_PROGRESS | AWS::Lambda::Function                | ApiLambdaPOSTbilling71E49732
20:55:44 | CREATE_COMPLETE    | AWS::CDK::Metadata                   | CDKMetadata
20:55:44 | UPDATE_IN_PROGRESS | AWS::Lambda::Function                | ApiLambdaPOSTnotes3B067E1B
20:56:16 | CREATE_IN_PROGRESS | AWS::CertificateManager::Certificate | ApiCertificate285C31EB
20:56:22 | UPDATE_COMPLETE    | AWS::Lambda::Function                | ApiLambdaPOSTbilling71E49732
20:56:22 | UPDATE_COMPLETE    | AWS::Lambda::Function                | ApiLambdaPUTnotesid28D10C39
20:56:22 | UPDATE_COMPLETE    | AWS::Lambda::Function                | ApiLambdaDELETEnotesid69A96EAD
20:56:23 | UPDATE_COMPLETE    | AWS::Lambda::Function                | ApiLambdaPOSTnotes3B067E1B
20:56:23 | UPDATE_COMPLETE    | AWS::Lambda::Function                | ApiLambdaGETnotesA3E56CF7
20:56:23 | UPDATE_COMPLETE    | AWS::Lambda::Function                | ApiLambdaGETnotesidBDFD7F2C
f
Hi @James, I just did a DNS lookup for
<http://futurekick.org|futurekick.org>
, it is still showing that it is managed by GoDaddy.
What’s going on here is that, when Amazon Certificate Manager tries to validate your domain, it will add a CNAME record in the Route 53 hosted zone u provided. And then it will do a lookup and look for the CNAME record.
But since the DNS is still pointing to GoDaddy, Amazon Certificate Manager is not able to see the CNAME record. And it keeps on polling.
When did u transfer the domain? I’m looking at the docs for Route 53, it seems DNS can take up to 48 hrs to propagate. https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/troubleshooting-new-dns-settings-not-in-effect.html#troubleshooting-n[…]ecent-dns-transfer
j
Hmm interesting, I did he transfer around 2 months ago to AWS but it is strange that it seems to have not completed. When I go on GoDaddy I cannot find the url in the domain anymore.
Will read through that article
There are no pending requests
thank you for help so far
Hi @Frank I think I worked out the issue, when I did the transfer originally I did not enter my own nameservers in GoDaddy in step 3 here. Because it has been over 30days the domain no longer shows on godaddy but I can still see the dns records. In short the whole thing is in a weird state and I am working out how to unstick it 😬
I have manually updated the name servers to the correct ones will rerun the pipeline and see if that works
will be praying that it works!
Well using this link https://serverless-stack.slack.com/archives/C01JG3B20RY/p1646114971548039?thread_ts=1645871105.053139&amp;cid=C01JG3B20RY I can see that it is definitely now being hosted by route53!
Great Success! Managed to get it working
j
👍
f
Awesome! Glad it’s working!