timothymiller / cloudflare-ddns

🎉🌩️ Dynamic DNS (DDNS) service based on Cloudflare! Access your home network remotely via a custom domain name without a static IP!
https://timknowsbest.com/free-dynamic-dns
GNU General Public License v3.0
3.13k stars 328 forks source link

Minimum TTL (30) not accepted by Cloudflare API #179

Open cotton105 opened 9 months ago

cotton105 commented 9 months ago

Describe the bug Setting the TTL in the config to anything below 60 for a non-Enterprise account causes the Cloudflare API request to fail, with error code 9021:

😡 Error sending 'POST' request to 'https://api.cloudflare.com/client/v4/zones/***/dns_records':
{"result":null,"success":false,"errors":[{"code":1004,"message":"DNS Validation Error","error_chain":[{"code":9021,"message":"TTL must be between 60 and 86400 seconds, or 1 for Automatic."}]}],"messages":[]}

To Reproduce Steps to reproduce the behavior:

  1. Change the ttl option in config.json to 30 (using a non-Enterprise Cloudflare account).
  2. Run python cloudflare-ddns.py --repeat.
  3. See error.

Expected behavior The TTL option should be set to 1 (auto), instead of continuing to try to use the invalid TTL in a POST request.

Desktop

QbikEdge commented 8 months ago

This is the expected behavior. Because Cloudflare does not accept less then 60 TTL

see error message TTL must be between 60 and 86400 seconds

also see DNS management view in Cloudflare it start with 1 min:

image