whodb icon indicating copy to clipboard operation
whodb copied to clipboard

[BUG] - Switching between signed in profiles prints error

Open bigbeka opened this issue 2 months ago • 5 comments

Describe the bug I am on version 0.75.0, and signed it to 2 Postgres profiles. When switching between profiles, the UI prints Error signing you in: unauthorized, although I am signed in to both profiles. The issue seems to be with missing or wrong default Database and Schema options chosen when a given profile is selected.

To Reproduce

  1. Login to two profiles
  2. Switch from one profile to another
  3. Previous profile's database is chose, but current profile doesn't have that database, hence error occurs.
  4. If the page with the new profile is manually reloaded, then I can choose the correct Database and Schema from dropdown and the correct tables are displayed.

Expected behavior When I switch between profiles, the correct (default/previous) Database and Schema for that Profile should be chosen.

This is a docker compose logs:

whodb-1  | 2025/11/16 12:35:35 [d3644c08bf58/QQA1nn3B1P-000586] "POST http://whodb.lan/api/query HTTP/1.1" from xx.xx.xx.xx - 200 107B in 7.025121ms
whodb-1  | 
whodb-1  | 2025/11/16 12:35:38 /app/src/plugins/postgres/db.go:62
whodb-1  | [error] failed to initialize database, got error failed to connect to `user=user database=prod`: xx.xx.xx.123:5432 (xx.xx.xx.123): server error: FATAL: database "prod" does not exist (SQLSTATE 3D000)
whodb-1  | 2025/11/16 12:35:38 [d3644c08bf58/QQA1nn3B1P-000587] "POST http://whodb.lan/api/query HTTP/1.1" from xx.xx.xx.xx - 200 68B in 6.818123ms
whodb-1  | time="2025-11-16T12:35:38Z" level=error msg="Failed to connect to PostgreSQL database" database=prod error="failed to connect to `user=user database=prod`: xx.0.0.123:5432 (xx.0.0.123): server error: FATAL: database \"prod\" does not exist (SQLSTATE 3D000)" hostname=xx.0.0.123 port=5432 username=user
whodb-1  | time="2025-11-16T12:35:38Z" level=error msg="Database connection failed during login - credentials unauthorized" database=prod hostname=xx.0.0.123 type=Postgres username=user
whodb-1  | 2025/11/16 12:35:38 [d3644c08bf58/QQA1nn3B1P-000588] "POST http://whodb.lan/api/query HTTP/1.1" from xx.xx.xx.xx - 200 27B in 21.222514ms

bigbeka avatar Nov 16 '25 12:11 bigbeka