Skip to content

PostgREST 12.1 frequently stuck in "Attempting to connect to the database..." (Local Development) #2361

@vhpx

Description

@vhpx

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 │ - 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions