Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    23.05 - Uncaught Error: Attempt to assign property "domain_records"

    Scheduled Pinned Locked Moved General pfSense Questions
    24 Posts 5 Posters 1.8k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • kiokomanK
      kiokoman LAYER 8 @jimp
      last edited by kiokoman

      i'm pretty sure it's still json and it's probably an error

      maybe @chrisjx can use postman / insomnia to check what the answer is

      maybe, but i'm just putting random stuff here without an account on digitalocean to try

      curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json' , "Authorization: Bearer {$this->_dnsPass}"));
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

      https://docs.digitalocean.com/reference/api/api-reference/#operation/domains_list_records

      https://docs.digitalocean.com/reference/api/api-reference/#operation/domains_update_record

      ̿' ̿'\̵͇̿̿\з=(◕_◕)=ε/̵͇̿̿/'̿'̿ ̿
      Please do not use chat/PM to ask for help
      we must focus on silencing this @guest character. we must make up lies and alter the copyrights !
      Don't forget to Upvote with the 👍 button for any post you find to be helpful.

      C 1 Reply Last reply Reply Quote 1
      • C
        chrisjx @kiokoman
        last edited by

        @kiokoman

        curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer <my-do-api-key>" "https://api.digitalocean.com/v2/domains/<my-root-domain>/records"
        

        I can confirm that executing the CURL command (as described in the DO API page) returns a fully loaded json set with name, data (ip), etc. It had 10 entries that looked like this:

        {
        	"id": 299240866,
        	"type": "A",
        	"name": "xxxxxx",
        	"data": "xx.xx.xxx.xx",
        	"priority": null,
        	"port": null,
        	"ttl": 300,
        	"weight": null,
        	"flags": null,
        	"tag": null
        }
        

        Will try to log the values being returned in the code and see what's different.

        Apologies for delay... appreciate the effort of those persisting with ideas.

        Thank you.

        C 1 Reply Last reply Reply Quote 0
        • C
          chrisjx @chrisjx
          last edited by

          This below seems to be working; IOW, not throwing any errors:

          Starting at what I think is line 1414. It's kind of messy but I was trying to figure out how to display the return values into the system log file. I'm jut no good at understanding how to stringify objects in PHP. In any case the five minute errors are no longer happening and I'm seeing messages like this every 5 minutes instead of errors:

          rc.dyndns.update: phpDynDNS (music): No change in my IP address and/or 25 days has not passed. Not updating dynamic DNS entry.
          

          Working...

          case 'digitalocean':
          	case 'digitalocean-v6':
          		// Get record ID
          		$server = 'https://api.digitalocean.com/v2/domains/';
          		$isv6 = ($this->_dnsService === 'digitalocean-v6');
          		$url = $server . $this->_dnsDomain . '/records';
          		curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Bearer {$this->_dnsPass}"));
          		curl_setopt($ch, CURLOPT_URL, $url);
          		curl_setopt($ch, CURLOPT_FORBID_REUSE, true);
          
          		// original line where error was thrown
          		// $output = json_decode(curl_exec($ch));
          
          		$response = curl_exec($ch);
          		// log_error(sprintf(gettext("DO API response: %s"), var_export($response)));
          
          		$output = json_decode($response);
          		// log_error(sprintf(gettext("DO API output: %s"), var_export($output)));
          
          		// log_error(sprintf(gettext("DO API output domain records: %s"), var_export($output->domain_records)));
          
          		if (!is_array($output->domain_records)) {
          			$output->domain_records = array();
          		}
          

          Thanks,
          Chris

          kiokomanK 1 Reply Last reply Reply Quote 1
          • kiokomanK
            kiokoman LAYER 8 @chrisjx
            last edited by

            well done,

            $response = curl_exec($ch);
            $output = json_decode($response);

            could be it

            ̿' ̿'\̵͇̿̿\з=(◕_◕)=ε/̵͇̿̿/'̿'̿ ̿
            Please do not use chat/PM to ask for help
            we must focus on silencing this @guest character. we must make up lies and alter the copyrights !
            Don't forget to Upvote with the 👍 button for any post you find to be helpful.

            1 Reply Last reply Reply Quote 0
            • C chrisjx referenced this topic on
            • First post
              Last post
            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.