Connecting to Vercel Postgres
I'm trying to connect to Vercel Postgres like this:
But I'm getting this error:
n [VercelPostgresError]: VercelPostgresError - 'missing_connection_string': You did not supply a 'connectionString' and no 'POSTGRES_URL' env var was found.
It seems like there's no credentials passing here and this sql
thing should read the connection string from .env
file which you need to pull from Vercel?
Am I doing something wrong or is the Vercel + Drizzle ORM mix not supported in dev environment yet?4 Replies
This error comes from Vercel and not drizzle
Seems like you didn’t specify url for vercel Postgres
Could it be trying to use POSTGRES_URL_NON_POOLING? I know it says
POSTGRES_URL
.
Before I hacked my implementation to use a local DB for local dev, I was successfully using the Vercel Postgres DB locally. I ran vercel env pull .env.development.local
and it grabbed a bunch of env secrets.Okay, I've just found the solution.
I'm using SvelteKit which uses Vite and apparently Vite does not expose .env variables on
process.env
by default.
Here's the solution:
https://github.com/vercel/storage/tree/main/packages/postgres#a-note-for-vite-usersGitHub
storage/packages/postgres at main · vercel/storage
Vercel Postgres, KV, Blob, and Edge Config . Contribute to vercel/storage development by creating an account on GitHub.
I managed to make it work 👍