mautrix / whatsapp

A Matrix-WhatsApp puppeting bridge
https://maunium.net/go/mautrix-whatsapp
GNU Affero General Public License v3.0
1.29k stars 175 forks source link

panic: failed to check if table exists #581

Closed officialdakari closed 1 year ago

officialdakari commented 1 year ago
[Dec 25, 2022 15:19:36] [INFO] Initializing mautrix-whatsapp 0.8.0+dev.03056803 (Dec 23 2022, 13:21:15 with go1.19.4)
[Dec 25, 2022 15:19:36] [DEBUG] Initializing database connection
[Dec 25, 2022 15:19:36] [DEBUG] Initializing state store
[Dec 25, 2022 15:19:36] [DEBUG] Initializing Matrix event processor
[Dec 25, 2022 15:19:36] [DEBUG] Initializing Matrix event handler
[Dec 25, 2022 15:19:36] [DEBUG] Bridge built with end-to-bridge encryption, but disabled in config
[Dec 25, 2022 15:19:36] [INFO] Bridge initialization complete, starting...
[Dec 25, 2022 15:19:36] [DEBUG] Running database upgrades
panic: failed to check if table exists: pq: Could not detect default username. Please provide one explicitly

goroutine 1 [running]:
maunium.net/go/mautrix/util/dbutil.(*Database).tableExistsNoError(0xc0002fa390?, {0x10f7c25?, 0x7faaafa1bfe8?})
        /builds/mautrix/whatsapp/.cache/pkg/mod/maunium.net/go/mautrix@v0.12.4/util/dbutil/upgrades.go:58 +0x73
maunium.net/go/mautrix/util/dbutil.(*Database).checkDatabaseOwner(0xc0003ee580)
        /builds/mautrix/whatsapp/.cache/pkg/mod/maunium.net/go/mautrix@v0.12.4/util/dbutil/upgrades.go:73 +0x6c
maunium.net/go/mautrix/util/dbutil.(*Database).Upgrade(0xc0003ee580)
        /builds/mautrix/whatsapp/.cache/pkg/mod/maunium.net/go/mautrix@v0.12.4/util/dbutil/upgrades.go:107 +0x33
maunium.net/go/mautrix/bridge.(*Bridge).start(0xc000326800)
        /builds/mautrix/whatsapp/.cache/pkg/mod/maunium.net/go/mautrix@v0.12.4/bridge/bridge.go:476 +0x7d
maunium.net/go/mautrix/bridge.(*Bridge).Main(0xc000326800)
        /builds/mautrix/whatsapp/.cache/pkg/mod/maunium.net/go/mautrix@v0.12.4/bridge/bridge.go:588 +0x489
main.main()
        /builds/mautrix/whatsapp/main.go:284 +0x33c

I get this when I start the bridge.

database:
        # The database type. "sqlite3-fk-wal" and "postgres" are supported.
        type: postgres
        # The database URI.
        #   SQLite: A raw file path is supported, but `file:<path>?_txlock=immediate` is recommended.
        #           https://github.com/mattn/go-sqlite3#connection-string
        #   Postgres: Connection string. For example, postgres://user:password@host/database?sslmode=disable
        #             To connect via Unix socket, use something like postgres:///dbname?host=/var/run/postgresql
        uri: file:/data/appservice.db?_txlock=immediate&_vacuum=1
        # Maximum number of connections. Mostly relevant for Postgres.
        max_open_conns: 20
        max_idle_conns: 2
        # Maximum connection idle time and lifetime before they're closed. Disabled if null.
        # Parsed with https://pkg.go.dev/time#ParseDuration
        max_conn_idle_time: null
        max_conn_lifetime: null

database config

tulir commented 1 year ago

The database config is wrong (wrong uri or type depending on what you're trying to do)