I’m trying to set up a vercel project with a postgres database, but I can’t seem to access the env variables and actually access the database. I’m in the root directory, and I run vercel env pull .env.development.local
which makes my directory look like this:
webapp
-.env.development.local
-src/
--app/
---api/
----create-project/
-----route.ts
In my route.ts file, this is the code I have:
import { sql } from '@vercel/postgres';
export default async function createProject() {
console.log({
POSTGRES_URL: process.env.NEXT_PUBLIC_POSTGRES_URL,
POSTGRES_URL_NON_POOLING: process.env.NEXT_PUBLIC_POSTGRES_URL_NON_POOLING
});
}
But the console.log returns undefined for both POSTGRES_URL and POSTGRES_URL_NON_POOLING. I’m very new to Vercel and NextJS, any ideas on how to fix this? To start local development, I run vercel dev