Router generation fails on "...OrThrow" queries
fleischerdesign opened this issue · comments
Bug description
Since updating to version 0.6.0, my route generation fails on all "OrThrow" queries. The generated Router has on all of those queries an undefined procedure name and an undefined input:
How to reproduce
- Run Prisma generate
- Look at the generated Router files
Expected behavior
The generated Procedure should be either "Mutation" or "Query" and the input should not be "undefined".
Prisma information
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
generator trpc {
provider = "prisma-trpc-generator"
withMiddleware = false
withShield = true
contextPath = "../../../../context"
isGenerateSelect = true
isGenerateInclude = true
}
model User {
id Int @id @default(autoincrement())
email String @unique
password String
name String
messages Message[]
tokens Token[]
ownedChats Chat[] @relation("Owner")
chats Chat[]
EmailConfirmation EmailConfirmation[]
}
model Message {
id Int @id @default(autoincrement())
createdAt DateTime
createdBy User @relation(fields: [creatorId], references: [id])
creatorId Int
chat Chat @relation(fields: [chatId], references: [id])
chatId Int
content String
}
model Chat {
id Int @id @default(autoincrement())
title String
createdAt DateTime
creatorId Int
creator User @relation(name: "Owner", fields: [creatorId], references: [id])
users User[]
messages Message[]
}
model Token {
id Int @id @default(autoincrement())
createdAt DateTime
token String @unique
user User @relation(fields: [userId], references: [id])
userId Int
lifetime Int
}
model EmailConfirmation {
id Int @id @default(autoincrement())
createdAt DateTime
token String @unique
user User @relation(fields: [userId], references: [id])
userId Int
lifetime Int
}
Environment & setup
OS: MacOS
Database: PostgreSQL
Node.js Version: 18.11.0
Prisma Version
prisma : 4.6.1
@prisma/client : 4.6.1
Current platform : darwin-arm64
Query Engine (Node-API) : libquery-engine 694eea289a8462c80264df36757e4fdc129b1b32 (at node_modules/@prisma/engines/libquery_engine-darwin-arm64.dylib.node)
Migration Engine : migration-engine-cli 694eea289a8462c80264df36757e4fdc129b1b32 (at node_modules/@prisma/engines/migration-engine-darwin-arm64)
Introspection Engine : introspection-core 694eea289a8462c80264df36757e4fdc129b1b32 (at node_modules/@prisma/engines/introspection-engine-darwin-arm64)
Format Binary : prisma-fmt 694eea289a8462c80264df36757e4fdc129b1b32 (at node_modules/@prisma/engines/prisma-fmt-darwin-arm64)
Format Wasm : @prisma/prisma-fmt-wasm 4.6.1-3.694eea289a8462c80264df36757e4fdc129b1b32
Default Engines Hash : 694eea289a8462c80264df36757e4fdc129b1b32
Studio : 0.476.0
I just ran into this too and believe I fixed it with this PR - #43. @omar-dulaimi would you mind reviewing?
@kristinlindquist Yes, of course. I'm taking a look at the code