'PayloadTooLargeError: request entity too large, tried setting limit still not working

I am having this problem in express.js I have been searching how to solve it but stilln nothing. I'm sending a base64 in the body of a pdf of about 130kb.

This is my index and. I added the limit in the app.use(express.urlencoded())

const express = require('express');
const db = require('./config/config');
const adminDb = require('./config/config');
const cors = require('cors')

const app = express();
app.use(cors());
app.options('*', cors());  // enable pre-flight
app.use(express.json());


//added this ↓↓↓↓↓↓↓↓
app.use(express.json({limit: '2500mb'}));
app.use(express.urlencoded({limit: '2500mb',extended: false, parameterLimit: 100000}));


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source