You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello I'm a newbie to typecript and decided to give brisa a try. After stumbling on some issues regarding to my lack of skill, today I had the misfortune to stumble across a very weird one:
brisa dev
[ info ] 🚀 Brisa 0.2.3: Running on Bun.js 1.1.43
[ wait ] starting the development server...
[ wait ] compiling 6 server entrypoints...
[ wait ] compiling server actions...
[ wait ] analyzing and preparing client build...
[ error ] Ops! Error:
[ error ] --------------------------
[ error ] Failed to build
[ error ] JSON.stringify cannot serialize BigInt.
[ error ] --------------------------
[ error ] TypeError: JSON.stringify cannot serialize BigInt.
at stringify (unknown)
at Pa (/home/moustacios/Workspace/Aivatar.Art/app/node_modules/brisa/out/cli/build.js:104:1955)
at processTicksAndRejections (native:7:39)
This happened after I have added the mongodb lib and written a function to return the result of .insertOne() as follows:
exportasyncfunctionsaveUser(payer: UserDetails,transactionId:string){constuser:UserAccount={
....};//(!) TODO cannot return here due to errorreturnawaitUsersCollection.insertOne(user);}
I added, the file src/types/global.d.ts and copied the declaration to src/pages/index.tsx. But nothing changed... . So I went around anc copied the declaration randomly at the top of other files hoping for misjudgment on my side.
Finally when I copied the declaration in src/middleware.ts the error went away 😃 .
I was really puzzled on the solution but glad I can continue.
The solution I'd like
I would like bigint to be supported by default, and not have to deal with these issue in future versions.
Alternative solutions I've considered
I was pretty annoyed of the fact that bun itself, does not complain about BigInt, but Brisa does.
So was considering writing an API separate of the brisa app, only running on bun, or switching to another framework.
Thanks.
The text was updated successfully, but these errors were encountered:
@adrian7 In order to better debug where this serialization is occurring, could you please report a minimal reproducible example to make sure we solve this? Thanks a lot and thanks to report it!
Hello I'm a newbie to typecript and decided to give brisa a try. After stumbling on some issues regarding to my lack of skill, today I had the misfortune to stumble across a very weird one:
This happened after I have added the mongodb lib and written a function to return the result of
.insertOne()
as follows:After some research on stack overflow, I found a suggested solution here: GoogleChromeLabs/jsbi#30 (comment)
I added, the file
src/types/global.d.ts
and copied the declaration tosrc/pages/index.tsx
. But nothing changed... . So I went around anc copied the declaration randomly at the top of other files hoping for misjudgment on my side.Finally when I copied the declaration in
src/middleware.ts
the error went away 😃 .I was really puzzled on the solution but glad I can continue.
The solution I'd like
I would like bigint to be supported by default, and not have to deal with these issue in future versions.
Alternative solutions I've considered
I was pretty annoyed of the fact that bun itself, does not complain about BigInt, but Brisa does.
So was considering writing an API separate of the brisa app, only running on bun, or switching to another framework.
Thanks.
The text was updated successfully, but these errors were encountered: