{"id":500,"hash":"5ab89240f97c7dc0e3a5aef415350220f8e1a40c2fed3e4135a28d1aeccc1105","pattern":"Nest.js - request entity too large PayloadTooLargeError: request entity too large","full_message":"I'm trying to save a JSON into a Nest.js server but the server crash when I try to do it, and this is the issue that I'm seeing on the console.log:\n\n[Nest] 1976   - 2018-10-12 09:52:04   [ExceptionsHandler] request entity too large PayloadTooLargeError: request entity too large\n\nOne thing is the size of the JSON request is 1095922 bytes, Does any one know How in Nest.js increase the size of a valid request? Thanks!","ecosystem":"npm","package_name":"node.js","package_version":null,"solution":"I found the solution, since this issue is related to express (Nest.js uses express behind scene) I found a solution in this thread Error: request entity too large,\nWhat I did was to modify the main.ts file add the body-parser dependency and add some new configuration to increase the size of the JSON request, then I use the app instance available in the file to apply those changes.\n\nimport { NestFactory } from '@nestjs/core';\nimport * as bodyParser from 'body-parser';\n\nimport { AppModule } from './app.module';\n\nasync function bootstrap() {\n  const app = await NestFactory.create(AppModule);\n  app.useStaticAssets(`${__dirname}/public`);\n  // the next two lines did the trick\n  app.use(bodyParser.json({limit: '50mb'}));\n  app.use(bodyParser.urlencoded({limit: '50mb', extended: true}));\n  app.enableCors();\n  await app.listen(3001);\n}\nbootstrap();","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/52783959/nest-js-request-entity-too-large-payloadtoolargeerror-request-entity-too-larg","votes":90,"created_at":"2026-04-19T04:51:16.268613+00:00","updated_at":"2026-04-19T04:51:16.268613+00:00"}