question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Domain exists and doesn't exist at the same time

See original GitHub issue

I’m having some trouble setting up a new domain. I’m just following the example in the docs but it doesn’t seem to work:

$ serverless create_domain
  Error: Record set for my.domain already exists. my.domain was not created.
$ serverless delete_domain
  Error: Record set for my.domain does not exist and cannot be deleted. my.domain was not deleted.
$ serverless create_domain
  BadRequestException: The domain name you provided is already associated with an existing CloudFront distribution. 
Remove the domain name from the existing CloudFront distribution or use a different domain name. 
If you own this domain name and are not using it on an existing CloudFront distribution, please contact support. my.domain was not created.
$ aws cloudfront --region us-east-1 list-distributions
<nothing>

My serverless.yml is pretty much the ‘hello world’ example, with this in the custom section:

custom:
  customDomain:
    domainName: my.domain
    basePath: ''
    stage: ${self:provider.stage}
    createRoute53Record: true

I haven’t used the domain before now so it can’t be in use. I can sls deploy and everything seems to work:

...
Serverless Domain Manager Summary
Domain Name
  my.domain
Distribution Domain Name
  xxx.cloudfront.net

But I can’t connect to the domain because I get a not-found error (which is because the domain isn’t listed in Route53.)

Any ideas what’s gone wrong?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
Malvineouscommented, Oct 1, 2017

Ah, that gives me:

Error= Error: AccessDenied: User: arn:aws:iam::48985952xxxx:user/username is not authorized to perform: route53:ListHostedZones Unable to retrieve Route53 hosted zone id.
    at hostedZonePromise.then.then.catch (node_modules/serverless-domain-manager/index.js:291:13)
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:228:7)

I had given myself the AmazonRoute53DomainsFullAccess policy, but this apparently only grants route53:CreateHostedZone and route53domains:*. It looks like I need AmazonRoute53ReadOnlyAccess to get this permission.

I gave myself that policy and it looks like everything is working now. Feel free to close the issue, or let me know if you add more error handling and would like me to test it.

Many thanks for your help!

0reactions
albertorestifocommented, Jan 11, 2018

I’m having this same issue:

sls deploy gives error:

Error: Could not set up basepath mapping. Try running sls create_domain first.
Error: Error: <redacted>' could not be found in API Gateway.
NotFoundException: Invalid domain name identifier specified

And sls create_domain gives:

Error: '<redacted>' was not created in API Gateway.
BadRequestException: The domain name you provided already exists.

Running aws apigateway get-domain-names does not show the domain in the list, not even specifying the region

Finally, the log suggested in https://github.com/amplify-education/serverless-domain-manager/issues/24#issuecomment-333374588 is never reached

Any ideas? I previously run sls create_domain on this project and it suceeded.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I check that a domain is available without triggering a ...
I use whois , nslookup and similar tools from the command line to check whether a domain is registered.
Read more >
dns - Domain name existence via "dig" - Stack Overflow
In my opinion NOERROR & SERVFAIL means the hostname exists (although it doesn't mean an ip is linked to it). NXDOMAIN would mean...
Read more >
Troubleshoot errors that occur when you join Windows-based ...
This article describes several common error messages that can occur when you join client computers that are running Windows to a domain.
Read more >
Do intermediate subdomains need to exist? - Server Fault
TL;DR: yes intermediate subdomains need to exist, at least when queried for, per definition of the DNS; they may not exist in the...
Read more >
What to do if the domain name you want is taken?
So you've come up with a great domain name...only to find out that it's already taken. Don't stress! There are many wonderful domain...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found