Fix DigitalOcean domain sync (never set .domain)

DigitalOcean.listDomains ran the API response through __parseRes, which does
not map anything to `.domain` and additionally rewrites each item's `.name` to
its subdomain via tld-extract. DO's /v2/domains returns objects keyed `name`
with no zone id, so the domain objects had no usable `.domain` and Domain.create
threw ObjectValidateError ("domain is not string type"), aborting the sync.

Map name -> domain the way CloudFlare.listDomains does and skip __parseRes (it
is for record responses). DO has no zone id; the earlier zoneId-omit fix covers
that. Also request per_page=200 so accounts with >20 domains aren't truncated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-10 23:17:43 -04:00
parent 618b87fc10
commit 39b4837fc6
+10 -2
View File
@@ -40,9 +40,17 @@ class DigitalOcean extends DnsApi{
}
async listDomains(){
let res = await this.axios('get', '/domains');
// DO returns {domains:[{name, ttl, zone_file}]} keyed by `name` and has no
// zone id (API paths use the domain name directly). Map name -> domain the
// way CloudFlare.listDomains does; do NOT run this through __parseRes, which
// rewrites `.name` to its subdomain and would leave no usable domain name.
let res = await this.axios('get', '/domains?per_page=200');
return this.__parseRes(res.data.domains);
for(let domain of res.data.domains){
domain.domain = domain.name;
}
return res.data.domains;
}
async getRecords(domain, options){