prisma: PANIC: called `Option::unwrap()` on a `None` value in query-engine/core/src/interpreter/query_interpreters/nested_read.rs:231:50
Bug description
Hi, I’m suddenly getting this on our Prisma server:
Thrown with args: {}
Resolver info : { prev: undefined, key: 'me', typename: 'Query' }
Model : User
Error : PrismaClientRustPanicError2 [PrismaClientRustPanicError]:
Invalid `prisma.user.findUnique()` invocation:
PANIC: called `Option::unwrap()` on a `None` value in query-engine/core/src/interpreter/query_interpreters/nested_read.rs:231:50
This is a non-recoverable error which probably happens when the Prisma Query Engine has a panic.
How to reproduce
- Launch your prisma project
- Leave it running for ~20 hours
- See the above error
Expected behavior
As Douglas Adams wrote, “Dont panic!”
Prisma information
Using paljs and nexus
query { me { id } }
Environment & setup
- OS: Linux using Docker node:16-buster
- Database:
generator client {
provider = "prisma-client-js"
previewFeatures = ["selectRelationCount", "filterJson", "referentialActions", "nApi"]
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
- Node.js version: 16
Prisma Version
"@prisma/client": "2.28.0",
"prisma": "2.28.0",
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 24 (9 by maintainers)
I can reproduce this issue. Please see this repo for a small reproduction. It seems as though this Rust Panic occurs when a relationship is created using a non-unique constraint. Some connectors check for this (SQLite) but others don’t and cause a runtime error (MySQL)
Notes:
My hunches are:
From what I can tell, 2.29 running without nApi is running solidly so far.
I wrote this healthcheck which correctly identifies when it has crashed:
And the model for this is:
The “implementation details” basically calls this:
and the model for user is
I could get the mysql schema too, but why would it work for many hours then die. I would expect a schema mis-match to not work straight away, and also be citing MySQL error codes
Our complete schema is propreitary however we are willing to send this as a confidential email to you.
Thank for your help with this. I will disable nApi now and report back in a day.