cli: PostgREST 12.1 frequently stuck in "Attempting to connect to the database..." (Local Development)
Describe the bug
Supabase PostgREST docker container logs:
2024-06-03 16:12:18 03/Jun/2024:09:12:18 +0000: Starting PostgREST 12.1...
2024-06-03 16:12:18 03/Jun/2024:09:12:18 +0000: Attempting to connect to the database...
2024-06-03 16:12:18 03/Jun/2024:09:12:18 +0000: Admin server listening on port 3001
2024-06-03 16:12:18 03/Jun/2024:09:12:18 +0000: Listening on port 3000
2024-06-03 16:12:18 03/Jun/2024:09:12:18 +0000: Listening for notifications on the "pgrst" channel
2024-06-03 16:12:18 03/Jun/2024:09:12:18 +0000: Successfully connected to PostgreSQL 15.1 (Ubuntu 15.1-1.pgdg20.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, 64-bit
2024-06-03 16:12:18 03/Jun/2024:09:12:18 +0000: Config reloaded
2024-06-03 16:12:19 03/Jun/2024:09:12:18 +0000: Schema cache queried in 7.2 milliseconds
2024-06-03 16:12:19 03/Jun/2024:09:12:18 +0000: Schema cache loaded 87 Relations, 83 Relationships, 48 Functions, 0 Domain Representations, 4 Media Type Handlers
2024-06-03 16:17:57 03/Jun/2024:09:17:57 +0000: Starting PostgREST 12.1...
2024-06-03 16:17:57 03/Jun/2024:09:17:57 +0000: Attempting to connect to the database...
2024-06-03 16:17:57 03/Jun/2024:09:17:57 +0000: Admin server listening on port 3001
2024-06-03 16:17:57 03/Jun/2024:09:17:57 +0000: Listening on port 3000
2024-06-03 16:17:57 Assertion failed: *(&once->n) != 4 (threads.c: k5_once: 564)
2024-06-03 16:17:57 03/Jun/2024:09:17:57 +0000: Starting PostgREST 12.1...
2024-06-03 16:17:57 03/Jun/2024:09:17:57 +0000: Attempting to connect to the database...
2024-06-03 16:17:57 03/Jun/2024:09:17:57 +0000: Admin server listening on port 3001
2024-06-03 16:17:57 03/Jun/2024:09:17:57 +0000: Listening on port 3000
2024-06-03 16:17:57 Assertion failed: *(&once->n) != 4 (threads.c: k5_once: 564)
2024-06-03 16:17:58 03/Jun/2024:09:17:58 +0000: Starting PostgREST 12.1...
2024-06-03 16:17:58 03/Jun/2024:09:17:58 +0000: Attempting to connect to the database...
2024-06-03 16:17:58 03/Jun/2024:09:17:58 +0000: Admin server listening on port 3001
2024-06-03 16:17:58 03/Jun/2024:09:17:58 +0000: Listening on port 3000
2024-06-03 16:17:58 Assertion failed: *(&once->n) != 4 (threads.c: k5_once: 564)
2024-06-03 16:17:59 03/Jun/2024:09:17:59 +0000: Starting PostgREST 12.1...
2024-06-03 16:17:59 03/Jun/2024:09:17:59 +0000: Attempting to connect to the database...
2024-06-03 16:17:59 03/Jun/2024:09:17:59 +0000: Admin server listening on port 3001
2024-06-03 16:17:59 03/Jun/2024:09:17:59 +0000: Listening on port 3000
2024-06-03 16:17:59 Assertion failed: *(&once->n) != 4 (threads.c: k5_once: 564)
2024-06-03 16:18:01 03/Jun/2024:09:18:01 +0000: Starting PostgREST 12.1...
2024-06-03 16:18:01 03/Jun/2024:09:18:01 +0000: Attempting to connect to the database...
2024-06-03 16:18:01 03/Jun/2024:09:18:01 +0000: Admin server listening on port 3001
2024-06-03 16:18:01 03/Jun/2024:09:18:01 +0000: Listening on port 3000
2024-06-03 16:18:01 Assertion failed: *(&once->n) != 4 (threads.c: k5_once: 564)
2024-06-03 16:18:05 03/Jun/2024:09:18:05 +0000: Starting PostgREST 12.1...
2024-06-03 16:18:05 03/Jun/2024:09:18:05 +0000: Attempting to connect to the database...
2024-06-03 16:18:05 03/Jun/2024:09:18:05 +0000: Admin server listening on port 3001
2024-06-03 16:18:05 03/Jun/2024:09:18:05 +0000: Listening on port 3000
2024-06-03 16:18:05 Assertion failed: *(&once->n) != 4 (threads.c: k5_once: 564)
2024-06-03 16:18:12 03/Jun/2024:09:18:12 +0000: Starting PostgREST 12.1...
2024-06-03 16:18:12 03/Jun/2024:09:18:12 +0000: Attempting to connect to the database...
2024-06-03 16:18:12 03/Jun/2024:09:18:12 +0000: Admin server listening on port 3001
2024-06-03 16:18:12 03/Jun/2024:09:18:12 +0000: Listening on port 3000
2024-06-03 16:18:12 Assertion failed: *(&once->n) != 4 (threads.c: k5_once: 564)
Which makes Next.js unable to produce development output when developing using pnpm dev, and returns the following error in the console:
{
code: 'PGRST002',
details: null,
hint: null,
message: 'Could not query the database for the schema cache. Retrying.',
digest: '4171135552'
}
and the error that prevented the development build output:
{
message: 'An invalid response was received from the upstream server',
digest: '1306904865'
}
System information
- Version of OS: Windows 11 23H2 (Build 22631.3672)
- Version of CLI: 1.172.2
- Version of Docker: v4.30.0
- Versions of services:
SERVICE IMAGE │ LOCAL │ LINKED
─────────────────────────┼──────────────────────┼────────────
supabase/postgres │ 15.1.1.56 │ 15.1.1.56
supabase/gotrue │ v2.152.0 │ v2.152.0
postgrest/postgrest │ v12.1 │ v12.1
supabase/realtime │ v2.28.32 │ -
supabase/storage-api │ v1.2.1 │ v1.2.1
supabase/edge-runtime │ v1.53.3 │ -
supabase/studio │ 20240422-5cf8f30 │ -
supabase/postgres-meta │ v0.80.0 │ -
supabase/logflare │ 1.4.0 │ -
bitnami/pgbouncer │ 1.20.1-debian-11-r39 │ -
darthsim/imgproxy │ v3.8.0 │ -
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 18 (8 by maintainers)
I’m unable to use this as of today as the container keeps crashing (related: https://github.com/supabase/cli/issues/3550)
Can somebody address this issue? It’s still happening. If it’s a problem with upstream PostgREST then please revert the version to a stable version or let us do it ourselves.
@guigzp for now, change the value in supabase/.temp/rest_version to
v12.0.2and restart local cli, it should work as a temporary fix.Since user is having problem on windows and not hosted, this error might be only specific to amd64 image of PostgREST. The v12.1 tag is available here https://github.com/supabase/cli/pkgs/container/postgrest/223414607?tag=v12.1
May be you can inspect it after docker pull ghcr.io/supabase/postgrest:v12.1