BigInt Problem
conioX opened this issue · 2 comments
Prerequisites
- I have written a descriptive issue title
- I have searched existing issues to ensure the bug has not already been reported
Fastify version
4.0.0
Plugin version
4.2.0
Node.js version
14.00
Operating system
Windows
Operating system version (i.e. 20.04, 11.3, 10)
Windows 11
Description
Hi Guys
I found a problem when use fastify with prisma.
when my prisma schema return BigInt fastify return this error
{"statusCode":500,"error":"Internal Server Error","message":"Do not know how to serialize a BigInt"}
when i search inside prisma issue i found this issue
this issue not come from prisma but the problem come from JSON.stringify, i think fast-json-stringify need to handle this
Steps to Reproduce
- install fastify-cli
- install prisma
- create db with bigint schema
Expected Behavior
No response
BigInt does not support serialization to JSON.
We should handle BigInt
according to the README.md
.
Lines 148 to 152 in 12fa1e9
We need a reproducible code to demonstrate it is happen inside fast-json-stringify
. BigInt
actually tested with
fast-json-stringify/test/bigint.test.js
Lines 1 to 76 in 4d990f6