From ee5ebb5766aad8d7f90898d546d0d16af113f597 Mon Sep 17 00:00:00 2001 From: WangDL Date: Sun, 24 May 2026 20:38:46 +0800 Subject: [PATCH] fix: add BigInt JSON serialization patch for Prisma BigInt columns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit UploadedFile.sizeBytes is BigInt → JSON.stringify throws TypeError. Add BigInt.prototype.toJSON to convert to Number globally. Co-Authored-By: Claude Opus 4.7 --- src/main.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main.ts b/src/main.ts index ed14af0..1b11c4b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,3 +1,6 @@ +// Patch BigInt JSON serialization (Prisma returns BigInt for BigInt columns) +;(BigInt.prototype as any).toJSON = function () { return Number(this) }; + import { NestFactory } from '@nestjs/core'; import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger'; import { AppModule } from './app.module';