admin管理员组

文章数量:1302273

I am currently working on a project where I use express with Prisma with Postgres db but I have recently ran into same error over and over again

ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(PostgresError { code: "42P05", message: "prepared statement \s0\ already exists", severity: "ERROR", detail: None, column: None, hint: None }), transient: false })

How can I fix this?

const user = await prisma.$transaction(async (tx) => {
    return await tx.user.findFirst({
        where: { email },
        select: {
            id: true,
            email: true,
            password: true,
            username: true,
            role: true,
            refreshToken: true
        }
    });
});
import { PrismaClient } from '@prisma/client'

const globalForPrisma = globalThis as unknown as {
  prisma: PrismaClient | undefined
}

export const prisma = globalForPrisma.prisma ?? new PrismaClient()

if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma
generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider  = "postgresql"
  url       = env("DATABASE_URL")
  directUrl = env("DIRECT_URL")
}

enum Role {
  ADMIN
  USER
}

model User{
  id String @id @default(uuid())
  username String @unique
  password String 
  role Role @default(USER)
  isVerified Boolean @default(false)
  refreshToken String? 
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  email String @unique
}

本文标签: postgresqlGetting 42P05 when trying to finUnique using prisma ormStack Overflow