title: nestjs 413 payload too large MULTIPART
body: <p>I'm using nestjs and an endpoint accept only files via multipart, when I try to upload files &lt; 10MB all works perfectly but when I try with >10Mb files I always get 413. I read many post with this </p>
  
  <pre><code> app.use(bodyParser.json({ limit: '50mb' }));
    app.use(bodyParser.urlencoded({
      limit: '50mb',
      extended: true,
      parameterLimit: 50000
    }));
  </code></pre>
  
  <p>But not works for me, I'm using multer so I will leave the config too.</p>
  
  <p>Main.ts</p>
  
  <pre><code>async function bootstrap() {
    Sentry.init({ dsn: 'https://5265e36cb9104baf9b3109bb5da9423e@sentry.io/1768434' });
    const app = await NestFactory.create(AppModule);
    app.useGlobalPipes(new ValidationPipe());
    app.use(helmet());
    app.use(bodyParser.json({ limit: '50mb' }));
    app.use(bodyParser.urlencoded({
      limit: '50mb',
      extended: true,
      parameterLimit: 50000
    }));
    app.enableCors();
    app.use(
      rateLimit({
        windowMs: 15 * 60 * 1000, // 15 minutes
        max: 20000, // limit each IP to 20000 requests per windowMs
      }),
    );
    app.use(compression());
    const options = new DocumentBuilder()
      .setTitle('Latineo Api')
      .setDescription('Api documentation for latineo')
      .setVersion('1.0')
      .addBearerAuth()
      .build();
    const document = SwaggerModule.createDocument(app, options);
    SwaggerModule.setup('api', app, document);
  
    await app.listen(3000);
  }
  </code></pre>
  
  <p>MyModule with multer config</p>
  
  <pre><code>@Module({
    controllers: [RestaurantsController],
    imports: [
      RestaurantsModule,
      MongooseModule.forFeature([{ name: 'Restaurant', schema: RestaurantSchema }]),
      GlobalModule,
      UsersModule,
      ConfigModule,
      MulterModule.registerAsync({
        imports: [ConfigModule],
        useFactory: async (configService: ConfigService) =&gt; ({
          storage: diskStorage({
            destination: `./${configService.uploadImages}`,
            filename: (req, file, cb) =&gt; {
              cb(null, `${uuid()}${extname(file.originalname)}`);
            },
          }),
          fileFilter: (req, file, cb) =&gt; {
            if (file.mimetype.match(/\/(jpg|jpeg|png)$/)) {
              cb(null, true);
            } else {
              cb(
                new BadRequestException(
                  'The image format is not valid only jpg, png are a valid format',
                ),
                false,
              );
            }
          },
          limits: {
            fileSize: 104857600,
            files: 10
          },
        }),
        inject: [ConfigService],
      }),
    ],
    providers: [UtilsService, RestaurantsService],
    exports: [RestaurantsService],
  })
  </code></pre>
  
  <p>info of the request
  <a href="https://i.stack.imgur.com/8NOjB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8NOjB.png" alt="enter image description here"></a></p>
  
  <p>endpoint header</p>
  
  <pre><code>@ApiBearerAuth()
    @UseGuards(FirebaseAuthGuard)
    @UseInterceptors(FilesInterceptor('imageUrls'))
    @ApiConsumes('multipart/form-data')
    @ApiFiles('imageUrls')
    @Put(':id/images')
    async uploadImagesRestaurant(
      @Param('id') id: string,
      @UploadedFiles() imageUrls,
      @Req() request: any,
    ): Promise&lt;RestaurantI&gt; {
  </code></pre>