PrismaP
Prisma13mo ago
9 replies
~/ Cultured Man

PrismaClientKnownRequestError: Invalid prisma.b2bTransaction.findUnique()

prisma table B2bTransaction exists in database cross-checked with the studio, but when try to use in hono on production, it gives this error:
PrismaClientKnownRequestError: Invalid prisma.b2bTransaction.findUnique() invocation: The table public.B2bTransaction does not exist in the current database.


table schema
model B2bTransaction {
  id                 String            @id @default(uuid())
  amount             Int               
  timestamp          DateTime          @default(now())
  status             TransactionStatus
  type               TransactionType

  webhookId          String?          @unique  // To track webhook processing
  webhookStatus      WebhookStatus?
  webhookAttempts    Int              @default(0)
  lastWebhookAttempt DateTime?
  
  senderUserId       String?
  receiverUserId     String?
  
  senderAccountNumber    String?     
  receiverAccountNumber  String?     
  
  senderBankName        String
  receiverBankName      String
  
  
  senderUser         User?     @relation("SenderBankRelation", fields: [senderUserId], references: [id], onDelete: SetNull)
  receiverUser       User?     @relation("ReceiverBankRelation", fields: [receiverUserId], references: [id], onDelete: SetNull)
  
  @@index([senderUserId])
  @@index([receiverUserId])
  @@index([webhookId])
}


target code:
    if (!decryptedData.txnId) {
      return { success: false, message: "Transaction ID not found", paymentToken: null };
    }

    // fetch transaction data
    const transaction = await db.b2bTransaction.findUnique({
      where: {
        id: decryptedData.txnId,
        //webhookId: webhookId!
      },
      select: {
        id: true,
        senderUserId: true,
        receiverUserId: true,
        senderBankName: true,
        amount: true,
        status: true,
        webhookStatus: true,
      },
    });


prisma version: "@prisma/client": "^5.22.0",
Was this page helpful?