serverless-domain-manager: Error: Unable to setup base domain mappings for

Community Note

  • Please vote on this issue by adding a šŸ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave ā€œ+1ā€ or ā€œme tooā€ comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Bug Report

Error Description Iā€™m trying to deploy my application to an AWS Account but Iā€™m getting the following message:

Error: Error: Unable to setup base domain mappings for YOUR_DOMAIN_HERE
  at ServerlessCustomDomain.<anonymous> (/app/artifacts/node_modules/serverless-domain-manager/dist/index.js:162:27)
  at Generator.throw (<anonymous>)
  at rejected (/app/artifacts/node_modules/serverless-domain-manager/dist/index.js:5:65)
  at processTicksAndRejections (internal/process/task_queues.js:97:5)

Iā€™m using a Docker image than contains serverless@1.70.1 to execute deploy.

Command Run

sls create_domain
sls deploy

Domain Manager Configuration Replace this with your own serverless.yml file (anonymized, of course) to help us better resolve your issue.

custom:
  customDomain:
    domainName: ${opt:domainName}
    stage: ${opt:stage}
    createRoute53Record: false
    endpointType: ${self:provider.endpointType}

Versions

  • Domain Manager version(s): 4.2.0
  • Node/npm version: 12.13.0
  • Serverless Version: 1.70.1
  • Lambda Code Nodejs

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 31
  • Comments: 17

Most upvoted comments

Just wanted to hop on this one after debugging. Running SLS_DEBUG=* sls deploy --stage prod resulted in these errors:

Serverless Domain Manager: Error: api.MY_DOMAIN.com:  Error: Failed to find a stack api-production

Serverless Domain Manager: Error: api.MY_DOMAIN.com:  Error: Failed to find CloudFormation resources for api.MY_DOMIAN.com

I my stack name is api-prod not production. This was because in my serverless.yml I had set the stage for the customDomain to production. Changing it to prod solved this for me.

Hope this helps someone else out there encountering this issue.

When the event was http everything worked for me however setting the event to httpApi broke with the above, the fix was to specify http in my custom domain, as below;

custom:
  customDomain:
    http:
      domainName: ...

rather than the code in the example I was following, which was

custom:
  customDomain:
    domainName:...

As a quick FYI and for those arriving here from a google search for the error.

Another cause of this could be under the value of customDomain where you can have a few different options, make sure your option matches the APIs you are building:

e.g.

    customDomain: {
      http: {
        domainName: 'MYDOMAIN.COM',
        basePath: '',
        certificateName: 'MYDOMAIN.COM',
        createRoute53Record: true,
        endpointType: 'regional',
        securityPolicy: 'tls_1_2'
      }
    },

vs

    customDomain: {
      websocket: {
        domainName: 'MYDOMAIN.COM',
        basePath: '',
        certificateName: 'MYDOMAIN.COM',
        createRoute53Record: true,
        endpointType: 'regional',
        securityPolicy: 'tls_1_2'
      }
    },

notice ā€œwebsocketā€ vs ā€œhttpā€

For anyone else stuck on this, I too enabled SLS_DEBUG=* and received a permission error. So this can be caused by a lack of permissions in IAM.

Just adding something that was biting me, I could not define my event as httpApi only http

Just adding something that was biting me, I could not define my event as httpApi only http

+1. This was it for me!

@MadisonEhlers-Vertex I had this setting already, so that doesnā€™t seem to help.

...
  customDomain:
    domainName: api.${opt:tld}
    basePath: ''
    stage: '$default'
    endpointType: regional
    apiType: http
    createRoute53Record: true

Hi @olegario96

Hope you have solved this issue.

We are not supporting 4.x any more please try our latest version 6.x and let us know in case of any issues

Spent some time working it out. Upgraded to ā€œserverless-domain-managerā€: ā€œ6.0.3ā€

root cause for the issue was that ā€˜sls create_domainā€™ was executed in different/wrong region.

I found custom domain in wrong region(Api Gateway > Custom domains in your AWS console).
Deleted custom domain from the console.
Run sls custom_domain (in correct region).
Run deploy and everything worked fine.
As I was using endpointType: ā€˜edgeā€™ my certificate has to be in us-west-1 but mistake was to create custom domain there as well as my app will run in different region.

My customDomain setup from serverless file: customDomain: domainName: ${self:provider.stackName}.my-domain.s24cloud.net stage: ${self:custom.stage} certificateName: ā€˜*.my-domain.s24cloud.netā€™ certificateArn: ā€˜arn:my-cert-arnā€™ createRoute53Record: true endpointType: ā€˜edgeā€™

Possible duplicate? #359

Just got this error as well trying to deploy an http api

Under Known Issues:

(8/22/2018) Creating a custom domain creates a CloudFront Distribution behind the scenes for fronting your API Gateway. This CloudFront Distribution is managed by AWS and cannot be viewed/managed by you. This is not a bug, but a quirk of how the Custom Domain feature works in API Gateway.

I donā€™t wanna cloudfront grrrr

Are there any update on this? Iā€™m currently running into the same issue