0

While calling dnsKeys().list, I am getting this error:

<HttpError 404 when requesting https://dns.googleapis.com/dns/v1/projects/<gcp_project_id>/managedZones/<managed_zone_name>/dnsKeys?alt=json returned "The 'collection' resource named 'dnsKeys' does not exist.".
Details: "[{'message': "The 'collection' resource named 'dnsKeys' does not exist.", 'domain': 'global', 'reason': 'notFound'}]"> - {}
Traceback (most recent call last):
    response = self.dns.dnsKeys().list(project=self.project['id'], managedZone=managed_zone_id).execute()
  File "<code_path>/venv/lib/python3.10/site-packages/googleapiclient/_helpers.py", line 130, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "<code_path>/venv/lib/python3.10/site-packages/googleapiclient/http.py", line 938, in execute
    raise HttpError(resp, content, uri=self.uri)

client and api call:

self.dns = discovery.build('dns', 'v1')

gcp_project="project_id"
managed_zone_id="managed_zone_id"
self.dns.dnsKeys().list(project=gcp_prject, managedZone=managed_zone_id).execute()

Any help would be much appreciated.

Purusottam
  • 611
  • 6
  • 19
  • Add more context to your question. Does the managed zone have DNSSEC enabled? The error message is **not found**. If DNSSEC is enabled, double check the Project Id and Managed Zone Id are correct. Note: you should check the return value from `dns.dnsKeys().list()` before calling `execute()`. – John Hanley Oct 17 '22 at 00:15
  • @JohnHanley DNSSEC is not enabled for the Managed Zone. Yes, I also tried to search for the error message and could not find anything. `dns.dnsKeys().list()` returns a http request. It does not throw any error. – Purusottam Oct 17 '22 at 01:13
  • Since you do not have DNSSEC enabled, you are getting an error (exception). Write a try/catch block to handle that. – John Hanley Oct 17 '22 at 01:24
  • Thanks for pointer @JohnHanley. I missed that if managed zone does not have dnssec enabled, then this api would fail. – Purusottam Oct 17 '22 at 01:37

1 Answers1

1

In addition to @JohnHanley's comment, the DNSSEC will be enabled and deployed correctly if the parent zone has the correct DS records.

You can use the following tools in checking and verifying if you have the correct configuration :

For a more detailed steps on how to enable DNSSEC configuration, you can check this guide

Marvin Lucero
  • 468
  • 1
  • 8