adminjs-prisma
adminjs-prisma copied to clipboard
TypeError: Do not know how to serialize a BigInt
TypeError: Do not know how to serialize a BigInt
at JSON.stringify (<anonymous>)
at stringify (/home/capaj/work-repos/official/official-graphql/prisma-admin/node_modules/express/lib/response.js:1150:12)
at ServerResponse.json (/home/capaj/work-repos/official/official-graphql/prisma-admin/node_modules/express/lib/response.js:271:14)
at ServerResponse.send (/home/capaj/work-repos/official/official-graphql/prisma-admin/node_modules/express/lib/response.js:162:21)
at handler (/home/capaj/work-repos/official/official-graphql/prisma-admin/node_modules/@adminjs/express/src/buildRouter.ts:60:15)
I got this in my schema:
id BigInt @id @default(autoincrement())
I think this is an issue with prisma itself and nothing to do with adminjs. https://github.com/prisma/studio/issues/816
facing the same issue
ok, So I fixed it by patching the bigint prototype
BigInt.prototype.toJSON = function () { const int = Number.parseInt(this.toString()) return int ?? this.toString() }
Yes we have the same hackfix In our own codebase. This should resolve it.