From a3357602e3d21af3858b6404294ab3639b876efd Mon Sep 17 00:00:00 2001 From: Sma1lboy <541898146chen@gmail.com> Date: Sun, 2 Feb 2025 16:34:54 -0600 Subject: [PATCH] feat: increase request body size limit to 50MB with verification --- llm-server/src/main.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/llm-server/src/main.ts b/llm-server/src/main.ts index dce315f3..289caf53 100644 --- a/llm-server/src/main.ts +++ b/llm-server/src/main.ts @@ -32,7 +32,16 @@ export class App { constructor(llmProvider: LLMProvider) { this.app = express(); - this.app.use(express.json()); + this.app.use( + express.json({ + limit: '50mb', + verify: (req, res, buf) => { + if (buf?.length > 50 * 1024 * 1024) { + throw new Error('Request body exceeds 50MB limit'); + } + }, + }), + ); this.PORT = parseInt(process.env.PORT || '8001', 10); this.llmProvider = llmProvider; this.logger.log(`App initialized with PORT: ${this.PORT}`);