• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
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.9k 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.
  • K
    kiokoman LAYER 8 @jimp
    last edited by kiokoman Jun 13, 2023, 6:54 PM Jun 13, 2023, 6:52 PM

    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 Jun 17, 2023, 11:59 PM Reply Quote 1
    • C
      chrisjx @kiokoman
      last edited by Jun 17, 2023, 11:59 PM

      @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 Jun 18, 2023, 9:02 PM Reply Quote 0
      • C
        chrisjx @chrisjx
        last edited by Jun 18, 2023, 9:02 PM

        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

        K 1 Reply Last reply Jun 19, 2023, 11:02 AM Reply Quote 1
        • K
          kiokoman LAYER 8 @chrisjx
          last edited by Jun 19, 2023, 11:02 AM

          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 Jun 29, 2024, 1:26 AM
          24 out of 24
          • First post
            24/24
            Last post
          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
            This community forum collects and processes your personal information.
            consent.not_received