PrismaP
Prisma15mo ago
8 replies
Mohammad Orabi 🇱🇧

Bug in TypedSQL in version 5.22

Here is my schema
postgres latest
generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["typedSql"]
}

my chest Table
model Chest {
  id          String          @id @default(cuid()) @map("id")
  name        String          @map("name")
  imageUrl    String?         @map("image_url")
  description String?         @map("description")
  rarity      Rarity          @map("rarity")
  amount      Int?            @map("amount")
  gameId      String          @map("game_id")
  game        Game            @relation(fields: [gameId], references: [id], onDelete: Cascade)
  currencies  ChestCurrency[]
  createdAt   DateTime        @default(now()) @map("created_at")
  updatedAt   DateTime        @updatedAt @map("updated_at")

  @@unique([gameId, rarity])
  @@index([gameId])
  @@map("chests")
}

my test query inside prisma/sql
-- @name test
SELECT *
FROM chests

implemention
  try {
    const result = await db.$queryRawTyped(test());
    log.info({
      msg: 'result',
      result,
    });
  } catch (error) {
    log.error({
      msg: 'Error in test query',
      error,
    });
  }

error
ERROR: Error in test query
    error: {
      "clientVersion": "5.22.0"
    }

error without a catch
"Cannot read properties of undefined (reading 'map')"
Was this page helpful?