serverless-domain-manager: 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
After creating a custom domain with sls create_domain
the deploy exits with error Unable to setup base domain mappings for <domain>
Command Run
sls create_domain
sls deploy --stage development
Console Output
Serverless Domain Manager: Error: <domain>: ValidationError: Resource WebsocketsApi does not exist for stack <stack>
Serverless Domain Manager: Error: <domain>: Error: Error: Failed to find CloudFormation resources for <domain>
Error --------------------------------------------------
Error: Error: Unable to setup base domain mappings for <domain>
Domain Manager Configuration
plugins:
- serverless-domain-manager
custom:
customDomain:
websocket:
domainName: <domain>
createRoute53Record: true
endpointType: 'regional'
securityPolicy: tls_1_2
certificateName: '<domain>'
Versions
- Domain Manager version(s): v4.0.0
- Node/npm version: Node 12.13.0/npm 6.12.0
- Serverless Version: 1.69.0
- Lambda Code Javascript
Additional context/Screenshots Already tried to delete the domain and recreated with no luck.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 37
- Comments: 23
Hello! I’m going to share my troubleshooting and my final solution because I wasted about 3 hours fighting with this (and I didn’t want to downgrade to v3). This was tested using version
6.0.3
.endpointType
toregional
andapiType
tohttp
endpointType
toedge
andapiType
torest
basePath
is not mandatory, you can skip it if you just wanna go from root path (e.g.my-api.subdomain.com/my-endpoint
instead ofmy-api.subdomain.com/api/my-endpoint
)[name]
MUST match the name of your CloudFormation stack name (you can check here the final name). If for some reason it doesn’t:sls remove
provider.stackName
I hope this helps someone.
If someone (like me) didn’t read the docs & tried
sls deploy
directly, please don’t forget to runsls create_domain
😀Just sharing what helped me.
If you are not using
Route 53
to manage the DNS for the domain, make sure you setcreateRoute53Record: false
in your serverless.yml file. This is what was causing the error for me.@chearmstrong if you did the original create_domain on the previous version you may need to delete the domain and then re-create it.
I recently upgraded from
serverless-domain-manager": "^3.3.2"
to"serverless-domain-manager": "^4.1.1"
in my Node.js Lambda app, and the domain had been originally created using the older version of this plugin. I just manually deleted the custom domain mapping in the AWS console at https://console.aws.amazon.com/apigateway/main/publish/domain-names?domain=<your-company-domain-here>®ion=us-east-1 and then it worked.Not sure if it matters but in my
serverless.yml
I was mapping the customDomain tonothing
, like so, see thebasePath:
I wanted to add my own problem/solution set in case it helps someone. In my case I fundamentally didn’t understand the difference between
rest
andhttp
for the API type. My APIs were being served over http and configured using thehttp
keyword so I should useapiType=http
right? Nope!Turns out my functions are actually configured to use
rest
, and so it was failing to connect the domain that was created withhttp
to the services that were created withrest
(or something like that).Just in case it might help someone (may not be the same issue as the OP).
In my case, I was migrating from REST API to HTTP API, the account that ran the sls deploy didn’t have APIGateway permission (the plugin didn’t say anything about permission but just the
Unable to setup base domain mappings
), I assigned apigateway admin policy then it worked, didn’t bother investigate what exactly permission was needed.It will be helpful if the plugin can print out more error information (if possible)
Added a comment on another similar issue here: https://github.com/amplify-education/serverless-domain-manager/issues/381#issuecomment-735318565
Might help someone in the future.
I’m running into the same error but not sure if what I’m trying to do is legal: I have two stacks (two repo, with two serverless.yml), I wanted to use the same domain for both of them and just change the basePath.
In my two
serverless.yml
I have:For the first stack, everything went ok (
create_domain
followed bydeploy
). In the second stack, when I try to deploy I run into:is this a bug? Or am I not supposed to share the same domain?
thanks
edit: yeah you can do it. Just rolled back to serverless-domain-manager@3 and everything’s working fine 😃
I’m getting this error and I’m not sure why.
My config:
The custom domain in the AWS console is showing as
regional
. If I try to configure the mappings manually, I get this error:Any ideas?
Following up the issue, my fault. Note that the custom domain must be configured in the same
serverless.yaml
file that uses the API Gateway in the first place.Thank you for the great work on supporting the websocket API Gateway 😃