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

feat(db-vercel-postgres): allow to use a local database using pg instead of @vercel/postgres #9771

Merged
merged 4 commits into from
Dec 16, 2024

Conversation

r1tsuu
Copy link
Member

@r1tsuu r1tsuu commented Dec 5, 2024

What?

This PR allows you to use a local database when using vercelPostgresAdapter. This adapter doesn't work with them because it requires an SSL connection and Neon's WS proxy. Instead we fallback to using pool from pg if hostname is either 127.0.0.1 or localhost.

If you still want to use @vercel/postgres even locally you can pass forceUseVercelPostgres: true here and you'd have to spin up the DB with a special Neon's Docker Compose setup - https://vercel.com/docs/storage/vercel-postgres/local-development#option-2:-local-postgres-instance-with-docker

Why?

Forcing people to use a cloud database locally isn't great. Not only they are slow but also paid.

@r1tsuu r1tsuu changed the title feat(db-vercel-postgres): allow to use a local database using pg feat(db-vercel-postgres): allow to use a local database using pg instead of @vercel/postgres Dec 5, 2024
@r1tsuu r1tsuu force-pushed the fix/local-database-with-vercel-postgres branch from e189979 to 528f2e8 Compare December 5, 2024 16:01
@r1tsuu r1tsuu requested review from DanRibbens and jmikrut December 5, 2024 16:23
Copy link
Contributor

@DanRibbens DanRibbens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We talked about renaming disableUsePgForLocalDatabase. I'm still thinking about alternatives.

@DanRibbens DanRibbens enabled auto-merge (squash) December 16, 2024 21:27
@denolfe denolfe disabled auto-merge December 16, 2024 21:55
@denolfe denolfe merged commit 41167bf into main Dec 16, 2024
62 of 63 checks passed
@denolfe denolfe deleted the fix/local-database-with-vercel-postgres branch December 16, 2024 21:55
Copy link
Contributor

🚀 This is included in version v3.8.0

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

Successfully merging this pull request may close these issues.

3 participants