[no app in context] Error: DNS lookup failed for nextcloud.com with type 32

Hello everybody,

Nextcloud version : Nextcloud hub 8 (29.0.1)
Operating system and version : Debian GNU/Linux 12 (bookworm)
(VM running on TrueNas, 1 virtual processor with 4 cores, 4 threads 4go RAM)
Apache or nginx version : Server version: Apache/2.4.59 (Debian)
PHP version : PHP 8.2.18 (cli)

The issue you are facing:

I’m having a recurring error regarding DNS resolve in my Security and setup warnings:

477 errors in the logs since 29 May 2024, 19:54:36
[no app in context] Error: DNS lookup failed for nextcloud.com with type 32
	GET /index.php/settings/ajax/checksetup
	from ROUTER_LOCAL_IP by REDACTED at 5 Jun 2024, 19:55:16

It’s the same error that pops up every time I do something on the server or every time I go to the Administration Overview.
I’m really 0 in computer science, I did all the install with tutorials from the net.

I’ve tried to fix it with the help of chatgpt but no luck there;

  • check the resolv.conf file => redirects to my router that handles DNS
  • check DNS resolve with dig nextcloud.com works fine
  • ping google.com and nextcloud.com works fine
  • check UFW status: (chatgpt recommended I open the port 53 for DNS)
To                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere
WWW Full                   ALLOW       Anywhere
22/tcp                     ALLOW       Anywhere
31/tcp                     ALLOW       Anywhere
53                         ALLOW       Anywhere
OpenSSH (v6)               ALLOW       Anywhere (v6)
WWW Full (v6)              ALLOW       Anywhere (v6)
22/tcp (v6)                ALLOW       Anywhere (v6)
31/tcp (v6)                ALLOW       Anywhere (v6)
53 (v6)                    ALLOW       Anywhere (v6)
  • check php config with test script, works fine:
<?php
$hostname = 'nextcloud.com';
$type = DNS_A;
$result = dns_get_record($hostname, $type);

if ($result === false) {
    echo "Failed to get DNS records.";
} else {
    print_r($result);
}
?>

Print:

Array
(
    [0] => Array
        (
            [host] => nextcloud.com
            [class] => IN
            [ttl] => 300
            [type] => A
            [ip] => 85.10.195.17
        )

)
  • Still following chatgpt went to /var/www/nextcloud/lib/private/Http/Client/DnsPinMiddleware.php

To add at line 113:

protected function dnsGetRecord(string $hostname, int $type): array|false {
    $result = \dns_get_record($hostname, $type);
    if ($result === false) {
        \OC::$server->getLogger()->error("DNS lookup failed for {$hostname} with type {$type}");
    }
    return $result;
}

To get more logs if I understand correctly.

Also ChatGPT told me this, dunno if relevant:

ME:
I get this error: {"reqId":"T0cLTVxlXPWqxWNpW1eh","level":3,"time":"2024-06-05T17:21:08+00:00","remoteAddr":"ROUTER_LOCAL_IP","user":"REDACTED","app":"no app in context","method":"GET","url":"/index.php/settings/ajax/checksetup","message":"DNS lookup failed for nextcloud.com with type 32","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36","version":"29.0.1.1","data":[]}

ChatGPT: The error message indicates that the DNS lookup for nextcloud.com failed with type 32, which corresponds to DNS_SRV (Service locator records) according to the DNS record types in PHP. This could be due to various reasons such as DNS server issues, network issues, or misconfigurations.

ME:
dig nextcloud.com SRV prints this: ; <<>> DiG 9.18.24-1-Debian <<>> nextcloud.com SRV
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 60018
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: bc55081a23691c630100000066609fb52bccec3b99e70e11 (good)
;; QUESTION SECTION:
;nextcloud.com.                 IN      SRV

;; AUTHORITY SECTION:
nextcloud.com.          3600    IN      SOA     ns.inwx.de. hostmaster.inwx.de. 2024051303 10800 3600 604800 3600

;; Query time: 23 msec
;; SERVER: ROUTER_LOCAL_IP#53(ROUTER_LOCAL_IP) (UDP)
;; WHEN: Wed Jun 05 19:26:13 CEST 2024
;; MSG SIZE  rcvd: 127

ChatGPT: The dig command output indicates that there are no SRV records for nextcloud.com. The response is NOERROR, meaning the query was successfully processed, but there are no SRV records available for nextcloud.com. This is expected because nextcloud.com does not have SRV records.

:dotted_line_face: :dotted_line_face: :dotted_line_face:

Is this the first time you’ve seen this error? (Y/N): Yes

Steps to replicate it:

  1. Install Nextcloud
  2. Do some config (Memcache with Redis and APCu)
  3. Profit?

The output of your Nextcloud log in Admin > Logging:

[no app in context] Error: Host: nextcloud.com, Type: 32
	GET /index.php/settings/ajax/checksetup
	from ROUTER by REDACTED at 5 Jun 2024, 20:11:32
[no app in context] Error: DNS lookup failed for nextcloud.com with type 32
	GET /index.php/settings/ajax/checksetup
	from ROUTER by REDACTED at 5 Jun 2024, 20:11:32
[PHP] Error: dns_get_record(): A temporary server error occurred. at /var/www/nextcloud/lib/private/Http/Client/DnsPinMiddleware.php#113
	GET /index.php/settings/ajax/checksetup
	from ROUTER by REDACTED at 5 Jun 2024, 20:11:32

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'REDACTED',
  'passwordsalt' => 'REDACTED',
  'secret' => 'REDACTED',
  'trusted_domains' =>
  array (
    0 => 'REDACTED',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '29.0.1.1',
  'overwrite.cli.url' => 'REDACTED',
  'dbname' => 'nextcloud_db',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextclouduser',
  'dbpassword' => 'REDACTED',
  'installed' => true,
  # Additional configuration
  'default_phone_region' => 'REDACTED',
  'maintenance_window_start' => 1,
  'memcache.local' => '\OC\Memcache\APCu',
  'memcache.distributed' => '\OC\Memcache\Redis',
  'memcache.locking' => '\OC\Memcache\Redis',
  'redis' => [
     'host'     => '/run/redis/redis-server.sock',
     'port'     => 0,
     'timeout'  => 0.0,
],
);

The output of your Apache/nginx/system log in /var/log/____:

/var/log/Apache2/error.log

Summary

[Wed Jun 05 00:00:02.151157 2024] [mpm_prefork:notice] [pid 1558] AH00163: Apache/2.4.59 (Debian) OpenSSL/3.0.11 configured – resuming normal operations
[Wed Jun 05 00:00:02.151184 2024] [core:notice] [pid 1558] AH00094: Command line: ‘/usr/sbin/apache2’
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

{"reqId":"um5VDVJFsMPltfZclXow","level":3,"time":"2024-06-05T18:11:32+00:00","remoteAddr":"ROUTEUR","user":"REDACTED","app":"PHP","method":"GET","url":"/index.php/settings/ajax/checksetup","message":"dns_get_record(): A temporary server error occurred. at /var/www/nextcloud/lib/private/Http/Client/DnsPinMiddleware.php#113","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36","version":"29.0.1.1","data":{"app":"PHP"}}
{"reqId":"um5VDVJFsMPltfZclXow","level":3,"time":"2024-06-05T18:11:32+00:00","remoteAddr":"ROUTER","user":"REDACTED","app":"no app in context","method":"GET","url":"/index.php/settings/ajax/checksetup","message":"DNS lookup failed for nextcloud.com with type 32","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36","version":"29.0.1.1","data":[]}
{"reqId":"um5VDVJFsMPltfZclXow","level":3,"time":"2024-06-05T18:11:32+00:00","remoteAddr":"ROUTER","user":"REDACTED","app":"no app in context","method":"GET","url":"/index.php/settings/ajax/checksetup","message":"Host: nextcloud.com, Type: 32","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36","version":"29.0.1.1","data":[]}

Those last three lines of errors are just repeated over and over in the log file.

If anybody can help that’s be greatly appreciated, I’m completely lost here. I work a lot so I will probably be present on this topic once a day but I will answer back and/or post the solution if I find it.

Thanks in advance.

PS: After writing this whole post I just added ‘loglevel’ => 2, to my Nextcloud config, I hope it wasn’t necessary to do it before, otherwise I will post the logs again.
Also tried to add “nameserver 9.9.9.11” to resolv.conf didn’t help, the error still pointed to the router adress.

1 Like

For me this is 1:
php -r "var_dump(DNS_A) ;"

On my system, 32 corresponds to the DNS_SOA entry:

php -r "var_dump(dns_get_record('nextcloud.com', DNS_SOA ) ) ;"
array(1) {
  [0]=>
  array(11) {
    ["host"]=>
    string(13) "nextcloud.com"
    ["class"]=>
    string(2) "IN"
    ["ttl"]=>
    int(86400)
    ["type"]=>
    string(3) "SOA"
    ["mname"]=>
    string(10) "ns.inwx.de"
    ["rname"]=>
    string(18) "hostmaster.inwx.de"
    ["serial"]=>
    int(2024051303)
    ["refresh"]=>
    int(10800)
    ["retry"]=>
    int(3600)
    ["expire"]=>
    int(604800)
    ["minimum-ttl"]=>
    int(3600)
  }
}
1 Like

Hello,
This was driving me crazy so I just decided to scrape it all and go with an old school debian as a server. Tks for your help tho

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.