Skip to content

fix: prisma db push fails silently due to missing DATABASE_URL_UNPOOLED #209

@rickstaa

Description

@rickstaa

Problem

On first run, ./bin/start.sh reports [WARN] Schema push had issues (may be fine on first run) and all database schemas end up with no tables. This causes relation "User" does not exist errors when trying to register or log in.

Root Cause

The Prisma schema defines a directUrl for non-pooled connections:

datasource db {
  url       = env("DATABASE_URL")
  directUrl = env("DATABASE_URL_UNPOOLED")
}

The directUrl field is required for production deployments behind connection poolers (PgBouncer/Supabase). However, Prisma validates that DATABASE_URL_UNPOOLED exists before running any command, even locally where there's no pooler.

The following scripts only set DATABASE_URL, causing prisma db push to fail silently:

  • bin/start.sh (line 689)
  • bin/db-setup.sh
  • bin/setup-db-simple.sh

Fix

Set DATABASE_URL_UNPOOLED="$UNIFIED_DB_URL" alongside DATABASE_URL in all prisma db push invocations. For local dev, both values are identical.

Metadata

Metadata

Assignees

Labels

staleNo recent activity

Type

No type

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions