Can't use dotenv and ws for edge runtime in authjs middlware. Help any solutions?

I am trying to set up Prisma with Neon in the Next-Auth v5 beta. I am running into an error where if i include dotenv or ws the middleware doesn't work because those packages use node run time. I took out the dotenv and ws it creates a new user but I don't know if this is correct. What is there purpose? Can i access the .env without "dotenv" and what is the purpose of ws? Below is my prisma.ts file. What is the correct way to do this? I tried removing ws and replacing with websocket does that work? //prisma.ts import { Pool, neonConfig } from "@neondatabase/serverless"; import { PrismaNeon } from "@prisma/adapter-neon"; import { PrismaClient } from "@prisma/client"; import dotenv from "dotenv"; //removed import ws from "ws"; //removed dotenv.config(); //removed neonConfig.webSocketConstructor = ws; //replaced with Websocket const connectionString = ${process.env.DATABASE_URL}; const pool = new Pool({ connectionString }); const adapter = new PrismaNeon(pool); declare global { var prisma: PrismaClient | undefined; } export const prisma = global.prisma || new PrismaClient({ adapter }); if (process.env.NODE_ENV !== "production") global.prisma = prisma;
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server