Stack: SvelteKit, Vercel, Prisma (Neon adapter) & Better Auth
I've tried so many solutions I can't even recall half of them. I've spent about three hours trying to get everything up and running and I just can't get rid of this error (attached)
Here's my related files, if anyone can help solve this I'd be forever grateful.
build cmd:
"build": "npx prisma generate && vite build",
schema.prisma:
provider = "prisma-client-js"
previewFeatures = ["driverAdapters"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
directUrl = env("DATABASE_URL_UNPOOLED")
}```
lib/prisma.ts:
```import { Pool, neonConfig } from "@neondatabase/serverless";
import { DATABASE_URL } from "$env/static/private";
import { PrismaClient } from "@prisma/client";
import { PrismaNeon } from "@prisma/adapter-neon";
import ws from "ws";
neonConfig.webSocketConstructor = ws;
const pool = new Pool({ connectionString: DATABASE_URL });
const adapter = new PrismaNeon(pool);
const prisma = new PrismaClient({ adapter });
export default prisma;
svelte.config.js:
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
/** @type {import('@sveltejs/kit').Config} */
const config = {
kit: {
adapter: adapter({
runtime: 'edge'
})
},
preprocess: vitePreprocess()
};
export default config;