-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Do not know how to serialize a BigInt #816
Comments
Hey @kakserpom, this was fixed in Prisma 3.7.0. If you update your Prisma version (or your electron app), this error should go away. Let me know if that's not the case, and I'll reopen! |
Hey, could you try out the latest Prisma CLI and let me know if this is fixed on there? I haven't released a new version of the Electron app yet, but I will do that with the next release (this Tuesday). If you could confirm that this is fixed for you on the CLI, then it'll be fixed in the Electron app as well (they use the same code). Let me know! |
@madebysid I am still seeing this using the Prisma CLI on Prisma v3.8.0:
|
Hmm, I can't seem to reproduce this, what are you doing exactly that causes this? Here's what I did:
|
Yeah I'm doing something different - I see the bug when looking at a row's relations. Schema: model User {
id BigInt @id
posts Post[]
}
model Post {
id BigInt @default(autoincrement())
userID BigInt
user User @relation(fields: [userID], references: [id])
@@id([userID, id])
} Steps: |
Ah, I see it now as well, weird. It only seems to happen when the ID is a BigInt. Nevertheless, I'll look into this, thanks for the repro! |
I ran into the same issue and created my own prisma studio launch script by using the studio-server. It almost works, but I now get a
I think it would be awesome if you could open source |
Not entirely true, consider this schema: model Guild {
id BigInt @id
channel BigInt?
addThread Boolean @default(false)
addButtons Boolean @default(true)
addUpdateHistory Boolean @default(false)
useEmbed Boolean @default(true)
suggestions Suggestion[]
} The studio is able to render them just fine: However, this one schema does not: model Suggestion {
id Int
guild Guild @relation(fields: [guildId], references: [id])
guildId BigInt
authorId BigInt
messageId BigInt
createdAt DateTime @default(now())
repliedAt DateTime?
archivedAt DateTime?
@@id([id, guildId])
} And will result on a non-recoverable error: A less hacky alternative to serialize bigints would be to use JSON.stringify's replacer argument. For example, this code is able to serialize BigInts just fine: JSON.stringify({ id: 42n }, (key, value) => (typeof value === 'bigint' ? value.toString() : value)); Results on: {"id":"42"} |
prisma -v
ornpx prisma -v
):3.6.0
TypeError: Do not know how to serialize a BigInt
at JSON.stringify ()
at new Tl (file:///Applications/Prisma%20Studio.app/Contents/Resources/app.asar/dist/renderer/assets/index.js:1:216912)
at bs (file:///Applications/Prisma%20Studio.app/Contents/Resources/app.asar/dist/renderer/assets/vendor.js:27:50128)
at Ha (file:///Applications/Prisma%20Studio.app/Contents/Resources/app.asar/dist/renderer/assets/vendor.js:27:67591)
at bl (file:///Applications/Prisma%20Studio.app/Contents/Resources/app.asar/dist/renderer/assets/vendor.js:27:105796)
at gu (file:///Applications/Prisma%20Studio.app/Contents/Resources/app.asar/dist/renderer/assets/vendor.js:27:97229)
at hu (file:///Applications/Prisma%20Studio.app/Contents/Resources/app.asar/dist/renderer/assets/vendor.js:27:97154)
at iu (file:///Applications/Prisma%20Studio.app/Contents/Resources/app.asar/dist/renderer/assets/vendor.js:27:94183)
at file:///Applications/Prisma%20Studio.app/Contents/Resources/app.asar/dist/renderer/assets/vendor.js:27:45779
at e.unstable_runWithPriority (file:///Applications/Prisma%20Studio.app/Contents/Resources/app.asar/dist/renderer/assets/vendor.js:18:3854)
Please add:
The text was updated successfully, but these errors were encountered: