MySQL: Expected parent IDs to be set when ordering by parent ID.
See original GitHub issueHi Prisma Team! My Prisma Client just crashed. This is the report:
Versions
Name | Version |
---|---|
Node | v16.15.0 |
OS | rhel-openssl-1.0.x |
Prisma Client | 4.0.0 |
Query Engine | da41d2bb3406da22087b849f0e911199ba4fbf11 |
Database | mysql |
Logs
prisma:tryLoadEnv Environment variables not found at null
prisma:tryLoadEnv Environment variables not found at undefined
prisma:tryLoadEnv No Environment variables loaded
prisma:tryLoadEnv Environment variables not found at null
prisma:tryLoadEnv Environment variables not found at undefined
prisma:tryLoadEnv No Environment variables loaded
prisma:client dirname /var/task/node_modules/.prisma/client
prisma:client relativePath ../../../prisma
prisma:client cwd /var/task/node_modules/.prisma/client
prisma:client clientVersion: 4.0.0
prisma:client clientEngineType: library
prisma:client:libraryEngine internalSetup
prisma:client:libraryEngine:loader Searching for Query Engine Library in /var/task/node_modules/.prisma/client
prisma:client:libraryEngine:loader loadEngine using /var/task/node_modules/.prisma/client/libquery_engine-rhel-openssl-1.0.x.so.node
prisma:client:libraryEngine sending request, this.libraryStarted: false
prisma:client:libraryEngine library starting
prisma:client:libraryEngine library started
prisma:client:request_handler {"clientVersion":"4.0.0"}
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:request_handler {"clientVersion":"4.0.0"}
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:request_handler {"clientVersion":"4.0.0"}
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:request_handler {"clientVersion":"4.0.0"}
prisma:client:libraryEngine sending request, this.libraryStarted: true
Client Snippet
prismaClient.user
.findUnique({
where: {
email: input?.email,
},
})
.words({
select: {
id: true,
score: true,
master: true,
wordData: true,
},
});
Schema
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
referentialIntegrity = "prisma"
}
model Account {
id String @id @default(cuid())
userId String @unique
type String
provider String
providerAccountId String
refresh_token String? @db.LongText
access_token String? @db.LongText
expires_at Int?
token_type String?
scope String?
id_token String? @db.Text
session_state String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
isAdmin Boolean @default(false)
isActive Boolean @default(true)
isDeleted Boolean @default(false)
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@unique([provider, providerAccountId])
}
model User {
id String @id @default(cuid())
name String?
email String? @unique
password String? @unique
emailVerified DateTime?
image String?
accounts Account[]
sessions Session[]
words Word[]
}
model Session {
id String @id @default(cuid())
sessionToken String @db.LongText
userId String @unique
expires DateTime
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
}
model VerificationToken {
identifier String
token String @unique
expires DateTime
@@unique([identifier, token])
}
model Word {
id String @id @default(cuid())
score Int @default(0)
master Boolean @default(false)
wordData WordData? @relation(fields: [word], references: [searchingWord])
word String @unique
user User? @relation(fields: [userId], references: [id])
userId String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model WordData {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
searchingWord String @unique
searchingEngine String
translations Json?
userWords Word[]
}
Prisma Engine Query
Query:
{
"modelName": "WordData",
"operation": "findMany",
"args": {
"take": 100,
"skip": 0,
"select": {
"id": true,
"createdAt": true,
"updatedAt": true,
"searchingWord": true,
"searchingEngine": true,
"translations": true,
"userWords": true
}
}
}
Issue Analytics
- State:
- Created a year ago
- Comments:11 (4 by maintainers)
Top Results From Across the Web
MySQL: PANIC: Expected parent IDs to be set when ordering ...
Hi Prisma Team! My Prisma Client just crashed. This is the report: Versions Name Version Node v12.22.7 OS debian-openssl-1.1.x Prisma Client 3.1.1 Query ......
Read more >how to get all children by multiple parent ids using IN() clause
I'm trying to get all children records by their parent IDs(multiple) using IN clause but its return only children belong to first parent...
Read more >Create parent node and parent id [closed]
I have a table which contains id , nodeid , nodevalue , and nodelevel columns. Now I want to create new temp column...
Read more >MySQL 8.0 Reference Manual :: 13.2.17 UPDATE Statement
To avoid this problem, add an ORDER BY clause to cause the rows with larger id values to be updated before those with...
Read more >Prisma Client API (Reference)
AssertionError("Expected a valid parent ID to be present for nested update to-one case.") If the related record that you want to update does...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jkomyno Thanks. Unfortunately, changing the database collation is not an option in production since everything relies on case insensitivity. I ran a query that fixed the inconsistent results across our database, which does the trick for now. But yes, I can confirm that a “bin” collation doesn’t have this issue in development.
Hi guys, Maybe I can bring some new information to this case. I’m facing this problem too, and I think I know de causes, and I want to know if it is the cause. I have this model:
I have two endpoints that are requested in one page at the same moment, and runs this same query. I read in the docs, that Prisma batches the findUnique method when requested in a tick.
In my codes, I use async/await, and when this executes, the first request ran and I get an OK and the second one returns:
I’m facing this problem too, and not just in prisma studio. I simulate this on studio, by querying
accountingAccount
the error is below:Maybe do I have to use Promise.then to this cases? I can put the codes that I developed, if you want. This are the versions that I’m using: