fix: use NestJS native useBodyParser instead of direct express import

The direct `import * as express from 'express'` caused a
MODULE_NOT_FOUND error in the Docker production image since express
is only available as a transitive dependency via @nestjs/platform-express.
Use NestExpressApplication.useBodyParser() which is the official NestJS API.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-02-28 04:01:54 -08:00
parent b9c3bfdf91
commit 2c657e2b4c
1 changed files with 4 additions and 4 deletions

View File

@ -1,8 +1,8 @@
import { NestFactory } from '@nestjs/core';
import { Logger } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { NestExpressApplication } from '@nestjs/platform-express';
import { WsAdapter } from '@nestjs/platform-ws';
import * as express from 'express';
import { AgentModule } from './agent.module';
const logger = new Logger('AgentService');
@ -16,9 +16,9 @@ process.on('uncaughtException', (error) => {
});
async function bootstrap() {
const app = await NestFactory.create(AgentModule);
// Increase body parser limit for base64 image attachments
app.use(express.json({ limit: '10mb' }));
const app = await NestFactory.create<NestExpressApplication>(AgentModule);
// Increase body parser limit for base64 image attachments (default 100KB is too small)
app.useBodyParser('json', { limit: '10mb' });
// Use raw WebSocket adapter instead of Socket.IO
app.useWebSocketAdapter(new WsAdapter(app));
const config = app.get(ConfigService);