fix: Increase request body size limit to 10MB for base64 image uploads
Some checks failed
CI/CD Pipeline / Lint and Test (push) Has been cancelled
CI/CD Pipeline / E2E Tests (push) Has been cancelled
CI/CD Pipeline / Build Application (push) Has been cancelled

Added express body parser configuration to support base64 image uploads:
- Set JSON payload limit to 10MB (up from default 100kb)
- Set URL-encoded payload limit to 10MB
- This allows users to upload profile photos and child photos via base64 encoding

Without this fix, uploading photos would result in 500 Internal Server Error due to payload too large.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-04 09:03:29 +00:00
parent 3f31eddeca
commit 4527224933

View File

@@ -5,7 +5,14 @@ import helmet from 'helmet';
import { WINSTON_MODULE_NEST_PROVIDER } from 'nest-winston'; import { WINSTON_MODULE_NEST_PROVIDER } from 'nest-winston';
async function bootstrap() { async function bootstrap() {
const app = await NestFactory.create(AppModule); const app = await NestFactory.create(AppModule, {
bodyParser: true,
rawBody: true,
});
// Increase body size limit for base64 image uploads (10MB)
app.use(require('express').json({ limit: '10mb' }));
app.use(require('express').urlencoded({ limit: '10mb', extended: true }));
// Replace default logger with Winston // Replace default logger with Winston
app.useLogger(app.get(WINSTON_MODULE_NEST_PROVIDER)); app.useLogger(app.get(WINSTON_MODULE_NEST_PROVIDER));