For Workers & Pages, what is the name of the domain?
What is the error number?
N/A
What is the error message?
N/A
What is the issue or error you’re encountering
After I called the API to update a TXT record, the first A record in my list of DNS records gets deleted. I can reproduce it every time I run the API! Why is this happening? I checked the audit log and there is no record of it being deleted!
What steps have you taken to resolve the issue?
Run the following command and the first DNS A record is deleted!
I modified the script to use PATCH. Same issue. Creating new TXT or updating existing TXT causes the first A record in my list to be deleted and audit logs does not show this. The script now reads as follows:
RECORD_ID=$(curl -s -X GET “https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records?name=$RECORD_NAME”
result[0].id
That looks like you are picking the first DNS record, which is in line with the behaviour you describe. I assume the A record you delete has the same name as the TXT record you want to update?
Ideally, you would look the RECORD_ID up once and hardcode it in your script. It shouldn’t ever change.