Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Certificate issue when using serverless and serverless-domain-manager with custom domain

I'm trying to set up a custom domain for my API Gateway and Lambda function.

I registered a domain with route53. Ex: myDomainToTestApi.net

I also created the certificates for: myDomainToTestApi.net, *.myDomainToTestApi.net, www.myDomainToTestApi.net

I installed the plugin serverless-domain-manager for serverless framerwork

In my serverless.yml I added (under custom):

 customDomain:
    domainName: myDomainToTestApi.net
    basePath: ''
    stage: ${opt:stage, 'dev'}
    certificateName: '*.myDomainToTestApi.net'
    createRoute53Record: true

ALL resources are in us-east-1

When I run:

sls create-domain

I receive the following error...

Serverless: Load command test
Serverless: Load command dashboard
Serverless: Invoke create_domain
Serverless: [AWS apigateway 404 0.374s 0 retries] getDomainName({ domainName: 'myDomainToTestApi.net' })
Serverless Domain Manager: NotFoundException: Invalid domain name identifier specified
Serverless: [AWS acm 200 0.35s 0 retries] listCertificates({ CertificateStatuses: [ 'PENDING_VALIDATION', 'ISSUED', 'INACTIVE', [length]: 3 ] })

  Error --------------------------------------------------

  Error: Error: Could not find the certificate *.myDomainToTestApi.net.
      at ServerlessCustomDomain.<anonymous> (/Users/user/project/node_modules/serverless-domain-manager/dist/index.js:279:23)

If I go to the Certificate Manager view, the status for all is Issued

Anyone knows what could be happening...? Thanks.

like image 220
Peter Avatar asked Jan 06 '20 21:01

Peter


Video Answer


1 Answers

Try to add another propertie called certificateArn, you can find certicateArn in the certificate manager detailed view of the domain

certificateArn: 'xxxxx'

enter image description here

like image 63
JParin Avatar answered Oct 12 '22 13:10

JParin