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.01k stars 316 forks source link

v.1.0.3 Multiple errors in logs. #125

Closed orpheus1120 closed 11 months ago

orpheus1120 commented 1 year ago

Describe the bug

Docker log show multiple instances of errors repeatedly as follows:

KeyError: 'load_balancer' 🕰ī¸ Updating IPv4 (A) records every 300 seconds Traceback (most recent call last): File "/cloudflare-ddns.py", line 306, in updateIPs(getIPs()) File "/cloudflare-ddns.py", line 245, in updateIPs updateLoadBalancer(ip) File "/cloudflare-ddns.py", line 191, in updateLoadBalancer for option in config["load_balancer"]:


KeyError: 'load_balancer'
🕰ī¸ Updating IPv4 (A) records every 300 seconds
Traceback (most recent call last):
File "/cloudflare-ddns.py", line 306, in <module>
updateIPs(getIPs())
File "/cloudflare-ddns.py", line 245, in updateIPs
updateLoadBalancer(ip)
File "/cloudflare-ddns.py", line 191, in updateLoadBalancer
for option in config["load_balancer"]:

To Reproduce

Run the latest release image. Note: This is without using the load balancing option in config.json .

Pull the docker logs via:

docker logs -f <cloudflare-ddns-container-name>

Expected behavior

There should not be any errors, except for

🕰ī¸ Updating IPv4 (A) records every 300 seconds

This release seems to update the IP successfully albeit with the above-mentioned errors.

Would also appreciate if previous releases are available to revert to.

timothymiller commented 1 year ago

Pushed a change to comment out the load balancer updating part for now.

Will revisit this later tonight.

timothymiller commented 1 year ago

Thanks for reporting this @orpheus1120 🙏đŸģ

aronmal commented 1 year ago

I also have errors:

Traceback (most recent call last):
  File "/cloudflare-ddns.py", line 306, in <module>
    updateIPs(getIPs())
  File "/cloudflare-ddns.py", line 244, in updateIPs
    commitRecord(ip)
  File "/cloudflare-ddns.py", line 124, in commitRecord
    response = cf_api("zones/" + option['zone_id'], "GET", option)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/cloudflare-ddns.py", line 210, in cf_api
    api_token = config['authentication']['api_token']
                ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
KeyError: 'api_token'

My config:

{
  "cloudflare": [
    {
      "authentication": {
        "api_key": {
          "api_key": "<my_Key>",
          "account_email": "<my_Mail"
        }
      },
      "zone_id": "<my_ID>",
      "subdomains": [
        {
          "name": "xyz"
        },
        {
          "name": "xyz4"
        },
        {
          "name": "xyz6"
        }
      ]
    }
  ],
  "a": true,
  "aaaa": true,
  "purgeUnknownRecords": false,
  "ttl": 300
}

Edit:

I had to add the 'api_token' line with an empty value and also the proxy false setting in every subdomain entry. Than it worked for me.