Skip to content

Commit

Permalink
fix:acmedns: handle "An identical record already exists"
Browse files Browse the repository at this point in the history
  • Loading branch information
yzqzss committed Nov 12, 2024
1 parent 09e4881 commit b99f397
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -862,12 +862,18 @@ class Listener {
try {
actres = await CFAPI.setRecord(zone_id, json.subdomain, json.txt);
} catch (e) {
return dns01cfError(`Error during DNS update: ${e.message}`, { status: 500 });
if (e.message.includes("An identical record already exists")) {
// it's a duplicate, so we'll just return success
actres = { message: e.message };
} else {
return dns01cfError(`Error during DNS update: ${e.message}`, { status: 500 });
}
}
return dns01cfResponse(
{
result: "ok",
message: `'${json.subdomain}' set to value '${json.txt}'`,
acmedns_success_msg: `${json.txt}`,
response: actres,
},
{ status: 200 },
Expand Down

0 comments on commit b99f397

Please sign in to comment.