Error: "Missing VercelPostgres connection string" when using insert query

Hey gamers, I'm going thru Theo's T3 stack tutorial to build a similar website (but with basic text post CRUD functions instead of images)

But i run into problems trying to set up the insert query. I've tried a shuffling things around but i always come to the same error when i run this on dev:

VercelPostgresError: VercelPostgresError - 'missing_connection_string': You did not supply a 'connectionString' and no 'POSTGRES_URL' env var was found.

But the .env file has very much been set up with this url, and im able to retrieval all the records that I currently set up in the server as a demo. I'm sure im missing something simple.

QUERIES.TS seems to be the issue. when i take this bit out, the page loads as normal (granted everything it's conencted to in the ui is commented out ofc)

import { type InsertPost, posts } from '~/server/db/schema';
import { db } from '../db/index';

export async function createFiveThingsPost(data: InsertPost) {
await db.insert(posts).values(data);
}
Was this page helpful?