From 0f436ec05a7d5075daa134d12dffee24a7c97e6d Mon Sep 17 00:00:00 2001 From: Moh Date: Sat, 8 Aug 2026 03:04:26 +0200 Subject: [PATCH] FIXED - Drop leftover Prisma ?schema=public from the DB URL - postgres.js forwarded schema as a startup param; Postgres rejected the connection - Remove ?schema=public from docker-compose, CI, and the client default - Strip any query string in lib/db/index.ts so this cannot recur --- .github/workflows/ci.yml | 2 +- docker-compose.yml | 2 +- lib/db/index.ts | 9 ++++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 20ed568..4651666 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ jobs: quality: runs-on: ubuntu-latest env: - DATABASE_URL: postgresql://postgres:postgres@localhost:5432/moh_sass?schema=public + DATABASE_URL: postgresql://postgres:postgres@localhost:5432/moh_sass NEXT_TELEMETRY_DISABLED: "1" steps: - name: Checkout diff --git a/docker-compose.yml b/docker-compose.yml index 9634699..797b9de 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,7 +14,7 @@ services: NEXT_PUBLIC_ADMIN_URL: ${NEXT_PUBLIC_ADMIN_URL:-https://root.mohfarawati.de} ADMIN_HOST: ${ADMIN_HOST:-root.mohfarawati.de} SITE_RUNTIME_ORIGIN: ${SITE_RUNTIME_ORIGIN:-http://127.0.0.1:3000} - DATABASE_URL: postgresql://postgres:postgres@db:5432/moh_sass?schema=public + DATABASE_URL: postgresql://postgres:postgres@db:5432/moh_sass ADMIN_PASSWORD: ${ADMIN_PASSWORD:?ADMIN_PASSWORD must be set in .env} ADMIN_AUTH_SECRET: ${ADMIN_AUTH_SECRET:?ADMIN_AUTH_SECRET must be set in .env (use a long random string)} ADMIN_BASIC_AUTH_USER: ${ADMIN_BASIC_AUTH_USER:?ADMIN_BASIC_AUTH_USER must be set in .env} diff --git a/lib/db/index.ts b/lib/db/index.ts index c7302da..370f6ba 100644 --- a/lib/db/index.ts +++ b/lib/db/index.ts @@ -8,9 +8,12 @@ import * as schema from "./schema"; * used by the other projects. Replaces the old Prisma client (`lib/prisma.ts`). * A single connection is reused across hot reloads in dev. */ -const connectionString = - process.env.DATABASE_URL ?? - "postgresql://postgres:postgres@localhost:5432/moh_sass?schema=public"; +// Strip any query string (e.g. a leftover Prisma `?schema=public`) — postgres.js +// forwards unknown params to the server as startup options and Postgres rejects +// them ("unrecognized configuration parameter"). `public` is the default schema. +const connectionString = ( + process.env.DATABASE_URL ?? "postgresql://postgres:postgres@localhost:5432/moh_sass" +).split("?")[0]; const globalForDb = globalThis as unknown as { dbClient: ReturnType | undefined;