Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Prisma cannot read env var when using directUrl with postgresql #72

Open
alexandruchircu opened this issue May 7, 2023 · 0 comments

Comments

@alexandruchircu
Copy link

Describe the bug
When using directUrl in prisma datasource, prisma complains that the connection url is empty.

To Reproduce
Steps to reproduce the behavior:

  1. Use a pooling URL for DATABASE_URL (postgresql://user:pass@url.supabase.co:6543/postgres?pgbouncer=true)
  2. Create a DIRECT_URL in .env (postgresql://user:pass@url.supabase.co:5432/postgres)
  3. Add DIRECT_URL to turbo.json
  4. Setup schema.prisma as below:
datasource db {
  provider  = "postgresql"
  url       = env("DATABASE_URL")
  directUrl = env("DIRECT_URL")
  shadowDatabaseUrl = env("DIRECT_URL")
}
  1. Run yarn db-push

Log:

root@proj-794877866d-d8trj:/src# yarn db-push
• Packages in scope: @my/api, @my/db, @my/ui, app, expo-app, nextjs
• Running db-push in 6 packages
• Remote caching disabled
@my/db:db-push: cache bypass, force executing 52d000672fac80cc
@my/db:db-push: Prisma schema loaded from prisma/schema.prisma
@my/db:db-push: Datasource "db": PostgreSQL database
@my/db:db-push: 
@my/db:db-push: Error: Connection url is empty. See https://www.prisma.io/docs/reference/database-reference/connection-urls
@my/db:db-push: ERROR: command finished with error: command (/src/packages/db) yarn run db-push exited (1)
command (/src/packages/db) yarn run db-push exited (1)

Expected behavior
Database is populated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant