P
Prisma4d ago
Simire

prisma 6.7.0 not working in production

i have router v7, prisma and neon application working well in development. i can login and out but when i deploy to netlify i got this error. schema: generator client { provider = "prisma-client" previewFeatures = ["queryCompiler", "driverAdapters"] output = "../app/generated/prisma" } datasource db { provider = "postgresql" url = env("DATABASE_URL") // directUrl = env("DATABASE_URL_UNPOOLED") }; prisma client: import { neonConfig } from "@neondatabase/serverless"; import { PrismaNeon } from "@prisma/adapter-neon"; import ws from "ws"; import dotenv from "dotenv"; import { PrismaClient } from "~/generated/prisma/client"; import { PrismaPg } from '@prisma/adapter-pg' dotenv.config(); declare global { /* eslint no-var: off */ var _prisma: PrismaClient | undefined; } neonConfig.webSocketConstructor = ws; const connectionString = ${process.env.DATABASE_URL}; // const adapter = new PrismaPg({ connectionString }) // const adapter = new PrismaNeon(pool) const adapter = new PrismaNeon({ connectionString }); //let prisma = new PrismaClient({adapter}) let prisma: PrismaClient; if (process.env.NODE_ENV === "production") { prisma = new PrismaClient({ adapter }); } else { if (!global._prisma) { global._prisma = new PrismaClient({ adapter }); // global._prisma.$connect(); } prisma = global._prisma; } export default prisma;
No description
8 Replies
Prisma AI Help
You chose to debug with a human. They'll tinker with your query soon. If you get curious meanwhile, hop into #ask-ai for a quick spin!
cointilt.dev - [ZHRM](🍄)
You'll need to get the logs for the error, that error tells us nothing.
Simire
SimireOP3d ago
ERROR Uncaught Exception {"errorType":"Runtime.UserCodeSyntaxError","errorMessage":"SyntaxError: Identifier 'dirname' has already been declared","stack":["Runtime.UserCodeSyntaxError: SyntaxError: Identifier 'dirname' has already been declared"," at _loadUserApp (file:///var/runtime/index.mjs:1084:17)"," at async UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1119:21)"," at async start (file:///var/runtime/index.mjs:1282:23)"," at async file:///var/runtime/index.mjs:1288:1"]}
Simire
SimireOP3d ago
No description
Simire
SimireOP3d ago
No description
cointilt.dev - [ZHRM](🍄)
I ran into that same issue. It was ESM format but causing duplicate __dirname and __filename declares. I spent too much time trying to figure out what was going wrong so I just made a patch script to run before deploying but after generating the client files. I thought it was the way SST was bundling RR7 with serverless functions on AWS. Are you using SST, or serverless?
Simire
SimireOP2d ago
serverless

Did you find this page helpful?