```Error in Prisma Client request: Error: Inval...
# orm-help
a
Copy code
Error in Prisma Client request: 

Error: 
Invalid `prisma.order.findMany()` invocation:

PANIC: Application logic invariant error: received null value for field post which may not be null
    at PrismaClientFetcher.request (/home/ashik/.cache/prisma/studio/home-ashik-exp-prisma2-react-boilerplate-packages-backend/runtime/index.js:1:86042)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
can anyone tell, why I am getting the above error in prisma studio? when order is created, I saw post is connected, you can see from the output of playground, there is a postId, no doubt post is connected. party postgres
s
Can you show the code which connects post?
And also your schema for Order?
a
schema for Order:
Copy code
model Order {
  id         Int      @default(autoincrement()) @id
  customer   User     @relation(fields: [customerId], references: [id])
  customerId Int
  post       Post     @relation(fields: [postId], references: [id])
  postId     Int
  Charge     Charge[]
}
s
Do you already have orders which have post as
null
?
a
nope, as you see from my playground picture, orderId is 1. so this is the first order. as soon as order is created, I got that error on prisma studio.
s
Ok, can you send me the schema for Post? I can cross-check it to see if there’s something missing!
a
sure.
Copy code
model Post {
  id        Int       @default(autoincrement()) @id
  title     String
  cost      Float?
  body      Json
  published Boolean
  author    User      @relation(fields: [authorId], references: [id])
  authorId  Int
  comments  Comment[]
  createdAt DateTime  @default(now())
  updatedAt DateTime  @default(now())
  Order     Order[]
}
s
hmm.. There’s nothing out of the ordinary. What’s your version of Prisma? Can you try clearing Indexed DB and the cache and see if studio works?
a
clearing indexed db means delete the migration folder and re generate it? and clear the cache means clear the browser cache? am I right?
s
No. Chrome > Developer Tools > Application > Clear Storage. This will clear Indexed DB, cookies, local storage.
1
a
same error exists: • before creating order I can click on the post table without facing any error • as soon as I create the order from playgroud, I reload the prisma studio and clicking on the order table I got this error (see red box of the picture) • after click on post table it gives me the error (see green box of the picture)
so, the error starts as soon as I create the order. 😕
@Naimur Rahman any thought on this?
s
What’s your Prisma version?
a
Copy code
"@prisma/client": "^2.1.3",
 "@prisma/cli": "^2.0.0-beta.5",
s
You should upgrade the client to the latest version. That should help solve this. There was an issue with the version of Prisma client you are using. Can you run this and get the actual version?:
Copy code
npx prisma --version
a
I think prisma client's latest version is what I am using (2.1.3)
s
Ah yes. though I think there is a newer version of the CLI which you should use.
💯 1
a
after upgrading the @prisma/cli it works!
👍🏼 1