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:
parent
b9c3bfdf91
commit
2c657e2b4c
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue