Closed bombillazo closed 4 months ago
When I try to connect to the database I get this error in the Pooler image container:
2024-06-19 10:58:07 14:58:07.673 region=local [error] ClientHandler: User not found: "Either external_id or sni_hostname must be provided" {:single, "postgres", nil}
2024-06-19 10:58:07 14:58:07.673 region=local [warning] client_join is called with a mismatched id: nil
2024-06-19 10:58:07 14:58:07.674 region=local [warning] ClientHandler: socket closed with reason {:shutdown, :user_not_found}
I had to revert to CLI v1.172.2 to avoid this issue
The original issue is caused by repeatedly adding the same tenant on service restart. I've addressed it in the beta release.
One thing to note is that connecting to pooler is only supported via the connecting string atm. For eg.
psql 'postgresql://postgres.pooler-dev:postgres@localhost:54329/postgres'
Hey @sweatybridge , we're still having this issue when we upgrade the CLI to the latest version while working in a Ubuntu environment.
I notice the pgbouncer
docker image is not downloaded while in my Mac OS environment we do have it.
Hmm we deprecated the pgbouncer image recently in favour of supavisor. So it sounds like your macOS environment is outdated?
Regarding the Ubuntu issue, I tried reproducing on gitpod.io but it started and restarted without issues. I tried both with and without stop --no-backup flag.
Could you confirm if the error log is identical? If so, is it also reproducible on gitpod/codespaces?
@sweatybridge These are the image versions Im running:
but I still get this error message from the supavisor contianer:
2024-07-02 12:26:23 16:26:23.575 request_id=F95yHqDXtgXjlj0AAANh region=local [info] Sent 204 in 233µs
2024-07-02 12:26:33 16:26:33.633 request_id=F95yIPhVhtPfxGcAAAOB region=local [info] HEAD /api/health
2024-07-02 12:26:33 16:26:33.633 request_id=F95yIPhVhtPfxGcAAAOB region=local [info] Sent 204 in 266µs
2024-07-02 12:26:39 16:26:39.435 region=local [error] ClientHandler: User not found: "Either external_id or sni_hostname must be provided" {:single, "supabase_admin", nil}
2024-07-02 12:26:39 16:26:39.435 region=local [warning] client_join is called with a mismatched id: nil
2024-07-02 12:26:39 16:26:39.435 region=local [warning] ClientHandler: socket closed with reason {:shutdown, :user_not_found}
2024-07-02 12:26:43 16:26:43.679 request_id=F95yI08fSrHznlkAAAOh region=local [info] HEAD /api/health
2024-07-02 12:26:43 16:26:43.679 request_id=F95yI08fSrHznlkAAAOh region=local [info] Sent 204 in 242µs
@sweatybridge should we use port 54329
as your example connection string? we've always used 6543
locally
should we use port 54329 as your example connection string? we've always used 6543 locally
It depends on whether your client is connecting from inside or outside containers. If you are connecting from inside edge runtime container, then you can use pooler:5432
for session mode and pooler:6543
for transaction.
But if you are connecting from outside, like running psql from
host OS, then you want to use localhost:54329
. I believe it's transaction mode by default but can be changed in config.toml.
Also note the special username of postgres.pooler-dev
used in my example connection string. The part after .
is the static tenant id required by supavisor to look up in its tenants table.
I believe the new error you reported is due to client connecting with a partial username that's missing the tenant id portion.
2024-07-02 12:26:39 16:26:39.435 region=local [error] ClientHandler: User not found: "Either external_id or sni_hostname must be provided" {:single, "supabase_admin", nil}
@sweatybridge Here are the logs from the pooler container as soon as it starts and i try to use the pooler connection:
2024-07-02 13:16:16 Setting RLIMIT_NOFILE to 100000
2024-07-02 13:16:17 17:16:17.294 [info] Migrations already up
2024-07-02 13:16:17 17:16:17.566 [notice] :alarm_handler: {:set, {:system_memory_high_watermark, []}}
2024-07-02 13:16:17 17:16:17.637 [notice] [description: 'Partisan node name generated and configured', disterl_enabled: false, name: :"cb2745da-3896-11ef-85cc-617ff023eab8@875d488d92d2"]
2024-07-02 13:16:17 17:16:17.643 [notice] [addr: {0, 0, 0, 0, 0, 0, 0, 1}, description: 'Resolved IP address for host', family: :inet6, host: '875d488d92d2']
2024-07-02 13:16:17 17:16:17.654 [info] [description: 'Not using container orchestration; disabling.']
2024-07-02 13:16:17 17:16:17.732 [info] [description: 'Starting Partisan listener', listen_addrs: [%{ip: {127, 0, 0, 1}, port: 20100}]]
2024-07-02 13:16:18 17:16:18.372 region=local [info] Elixir.Supavisor.SignalHandler is being initialized...
2024-07-02 13:16:18 17:16:18.387 region=local [warning] Proxy started transaction on port 6543, result: {:ok, #PID<0.396.0>}
2024-07-02 13:16:18 17:16:18.388 region=local [warning] Proxy started session on port 5432, result: {:ok, #PID<0.499.0>}
2024-07-02 13:16:18 17:16:18.391 region=local [notice] SYN[nonode@nohost] Adding node to scope <tenants>
2024-07-02 13:16:18 17:16:18.398 region=local [notice] SYN[nonode@nohost] Creating tables for scope <tenants>
2024-07-02 13:16:18 17:16:18.404 region=local [notice] SYN[nonode@nohost|registry<tenants>] Discovering the cluster
2024-07-02 13:16:18 17:16:18.406 region=local [notice] SYN[nonode@nohost|pg<tenants>] Discovering the cluster
2024-07-02 13:16:18 17:16:18.595 region=local [info] Running SupavisorWeb.Endpoint with cowboy 2.10.0 at 0.0.0.0:4000 (http)
2024-07-02 13:16:18 17:16:18.598 region=local [info] Access SupavisorWeb.Endpoint at http://localhost:4000
2024-07-02 13:16:19 17:16:19.680 [notice] [description: 'Partisan node name configured', disterl_enabled: false, name: :supavisor@875d488d92d2]
2024-07-02 13:16:19 17:16:19.681 [notice] :alarm_handler: {:set, {:system_memory_high_watermark, []}}
2024-07-02 13:16:19 17:16:19.682 [notice] [addr: {0, 0, 0, 0, 0, 0, 0, 1}, description: 'Resolved IP address for host', family: :inet6, host: '875d488d92d2']
2024-07-02 13:16:19 17:16:19.683 [info] [description: 'Not using container orchestration; disabling.']
2024-07-02 13:16:19 17:16:19.684 [info] [description: 'Starting Partisan listener', listen_addrs: [%{ip: {127, 0, 0, 1}, port: 20100}]]
2024-07-02 13:16:19 17:16:19.686 region=local [info] Elixir.Supavisor.SignalHandler is being initialized...
2024-07-02 13:16:19 17:16:19.687 region=local [warning] Proxy started transaction on port 6543, result: {:ok, #PID<0.2766.0>}
2024-07-02 13:16:19 17:16:19.688 region=local [warning] Proxy started session on port 5432, result: {:ok, #PID<0.2869.0>}
2024-07-02 13:16:19 17:16:19.688 region=local [notice] SYN[supavisor@875d488d92d2] Adding node to scope <tenants>
2024-07-02 13:16:19 17:16:19.689 region=local [notice] SYN[supavisor@875d488d92d2] Creating tables for scope <tenants>
2024-07-02 13:16:19 17:16:19.689 region=local [notice] SYN[supavisor@875d488d92d2|registry<tenants>] Discovering the cluster
2024-07-02 13:16:19 17:16:19.689 region=local [notice] SYN[supavisor@875d488d92d2|pg<tenants>] Discovering the cluster
2024-07-02 13:16:19 17:16:19.699 region=local [info] Running SupavisorWeb.Endpoint with cowboy 2.10.0 at 0.0.0.0:4000 (http)
2024-07-02 13:16:19 17:16:19.706 region=local [info] Access SupavisorWeb.Endpoint at http://localhost:4000
2024-07-02 13:16:19 17:16:19.739 region=local [info] [libcluster:postgres] Connected to Postgres database
2024-07-02 13:16:18 [os_mon] memory supervisor port (memsup): Erlang has closed
2024-07-02 13:16:18 [os_mon] cpu supervisor port (cpu_sup): Erlang has closed
2024-07-02 13:16:26 17:16:26.843 request_id=F9502eGS1q040REAAAAH region=local [info] HEAD /api/health
2024-07-02 13:16:26 17:16:26.843 request_id=F9502eGS1q040REAAAAH region=local [info] Sent 204 in 125µs
2024-07-02 13:16:30 17:16:30.967 region=local [error] ClientHandler: User not found: "Either external_id or sni_hostname must be provided" {:single, "postgres", nil}
2024-07-02 13:16:30 17:16:30.968 region=local [warning] client_join is called with a mismatched id: nil
2024-07-02 13:16:30 17:16:30.968 region=local [warning] ClientHandler: socket closed with reason {:shutdown, :user_not_found}
I am on the latest CLI version, not sure why I still get the issue. How can I verify I am using the image with the fix you pushed?
@sweatybridge Ok got it, so what should the tenant ID be for local?
Tenant id on local is hardcoded as pooler-dev
. So the full username to pass to Postgres client is
postgres.pooler-dev
.
Which library are you using to connect? May be it has problem supporting this syntax.
Your docker container logs look ok, ie. health check is passing with 204. The error probably came from your app client connecting.
Thats it! pooler-dev
Im using pg
driver to connect to the DB from our backend, but when we upgraded CLIs our env variables did not have the tenant appended to the DB user var. Thanks, now it works!
Tenant id on local is hardcoded as
pooler-dev
. So the full username to pass to Postgres client ispostgres.pooler-dev
.Which library are you using to connect? May be it has problem supporting this syntax.
Your docker container logs look ok, ie. health check is passing with 204. The error probably came from your app client connecting.
I tried. It works now. Big thx.
Describe the bug A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior:
supabase start
Expected behavior All stack including pooler start up succesfully
System information