notify_push icon indicating copy to clipboard operation
notify_push copied to clipboard

Advanced connection string in config.php is misparsed

Open Alphakilo opened this issue 5 months ago • 2 comments

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Requirements

Have a PostgreSQL database that requires TLS connections.

pg_hba.conf:

hostssl    nextcloud    nextcloud       x.x.x.x/32          scram-sha-256

Steps to reproduce

  1. Add the connection string to the config.php: 'dbhost' => 'db.example.org;sslmode=verify-ca;sslrootcert=/etc/ssl/certs/ca-certificates.crt;dbname=nextcloud'
  2. Attempt to start notify_client

Expected behaviour

notify_client parses the string, connects to the database and starts.

Actual behaviour

notify_client exits non-zero with the following error message:

Error:   × Failed to connect to database: error communicating with database: failed to lookup address information: Name does not resolve
  ├─▶ error communicating with database: failed to lookup address information: Name does not resolve
  ╰─▶ failed to lookup address information: Name does not resolve

Server configuration

Web server: Apache

Database: PostgreSQL 16

PHP version: 8.2

Nextcloud version: 31.0.7

Alphakilo avatar Jul 27 '25 07:07 Alphakilo

Can you provide the output of notify_push --dump-config config.php (redacting the passwords etc from the output)

icewind1991 avatar Aug 11 '25 09:08 icewind1991

Sure thing, thanks for looking into this @icewind1991

Config {
    database: AnyConnectOptions {
        database_url: Url {
            scheme: "postgresql",
            cannot_be_a_base: false,
            username: "nextcloud",
            password: Some(
                "redacted",
            ),
            host: Some(
                Domain(
                    "db.example.org;sslmode=verify-ca;sslrootcert=",
                ),
            ),
            port: None,
            path: "/etc/ssl/certs/ca-certificates.crt;dbname=nextcloud/nextcloud",
            query: None,
            fragment: None,
        },
        log_settings: LogSettings {
            statements_level: Debug,
            slow_statements_level: Warn,
            slow_statements_duration: 1s,
        },
    },
    database_prefix: "oc_",
    redis: Single(
        RedisConnectionInfo {
            addr: Tcp {
                host: "127.0.0.1",
                port: 6379,
                tls: false,
            },
            db: 0,
            username: None,
            password: None,
            tls_params: None,
        },
    ),
    nextcloud_url: "https://example.org/",
    metrics_bind: None,
    log_level: "warn",
    bind: Tcp(
        0.0.0.0:7867,
    ),
    allow_self_signed: false,
    no_ansi: false,
    tls: None,
    max_debounce_time: 15,
    max_connection_time: 0,
}

config.php:

❯ grep "'db" /var/www/nextcloud/config/config.php
  'dbtype' => 'pgsql',
  'dbname' => 'nextcloud',
  'dbhost' => 'db.example.org;sslmode=verify-ca;sslrootcert=/etc/ssl/certs/ca-certificates.crt;dbname=nextcloud',
  'dbport' => '5432',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'nextcloud',
  'dbpassword' => 'redacted',

Alphakilo avatar Aug 12 '25 03:08 Alphakilo