When using @prisma/adapter-pg, are additional options required for DATABASE_URL?
When using @prisma/adapter-pg, are additional options required for DATABASE_URL?
error: User was denied access on the database
db-name
version 6.162 Replies
You chose to compile with the bot. One moment while I piece together your answer…
Short answer: no special DATABASE_URL options are required just because you’re using @prisma/adapter-pg. With driver adapters, Prisma doesn’t read the connection string from schema.prisma; you must pass the connection string (or pg options) in code when creating the adapter. For example:
In this setup, DATABASE_URL should be a normal Postgres connection URL (e.g., postgresql://USER:PASSWORD@HOST:PORT/DB?schema=public). No extra flags are required for the adapter itself. If you’re deploying to Cloudflare Workers/Pages with a traditional Postgres over TCP, ensure node_compat is enabled and use @prisma/adapter-pg as shown. [Notes: drivers; Cloudflare Postgres]
“User was denied access” (P1010) comes from the database, not Prisma. It usually indicates incorrect credentials, wrong user/database/schema, connecting to the wrong host/port, or using a pooled connection string where a direct connection is required (e.g., Supabase: use pgbouncer=true for pooled client connections and a direct DIRECT_URL for migrations/introspection). [Issue 7682; Supabase pooled vs direct; Supabase direct/pgBouncer]
Checklist to resolve:
- Verify DATABASE_URL user/password, host, port, db name, and optional schema are correct. [Connect DB]
- If using a pooler (Supabase),
use pgbouncer=true for client connections and a direct URL for migrations/introspection. [Issue 21777]
- Ensure the DB user has privileges on the target database/schema. [Issue 20251]
- Make sure your app is actually using the same DATABASE_URL you expect (env loading in the runtime container). [Issue 27499]
Conversation continued in the other thread:
https://discord.com/channels/937751382725886062/1111711591575064648/threads/1415722647827775518