javascript - PayloadTooLargeError on loopback 3 -
i need save base64 image in loopback model. when i'm saving base64 image error saying . have tried updating in middleware same added below, have done before in loopback2, project upgraded loopback3 , got stuck in problem, appreciated
stack trace
unhandled error request post /api/assets/{type}/upload: payloadtoolargeerror: request entity large @ readstream (/project/node_modules/raw-body/index.js:155:17) @ getrawbody (/project/node_modules/raw-body/index.js:108:12) @ read (/project/node_modules/body-parser/lib/read.js:77:3) @ urlencodedparser (/project/node_modules/body-parser/lib/types/urlencoded.js:116:5) @ layer.handle [as handle_request] (/project/node_modules/express/lib/router/layer.js:95:5) @ trim_prefix (/project/node_modules/express/lib/router/index.js:317:13) @ /project/node_modules/express/lib/router/index.js:284:7 @ function.process_params (/project/node_modules/express/lib/router/index.js:335:12) @ next (/project/node_modules/express/lib/router/index.js:275:10) @ jsonparser (/project/node_modules/body-parser/lib/types/json.js:118:7) @ layer.handle [as handle_request] (/project/node_modules/express/lib/router/layer.js:95:5) @ trim_prefix (/project/node_modules/express/lib/router/index.js:317:13) @ /project/node_modules/express/lib/router/index.js:284:7 @ function.process_params (/project/node_modules/express/lib/router/index.js:335:12) @ next (/project/node_modules/express/lib/router/index.js:275:10) @ nosniff (/project/node_modules/dont-sniff-mimetype/index.js:4:5)
server.js
let loopback = require('loopback'); let boot = require('loopback-boot'); let bodyparser = require("body-parser"); let app = module.exports = loopback(); app.use(bodyparser.urlencoded({extended: true,limit:10485760}));
config.json
{ "restapiroot": "/api", "host": "0.0.0.0", "port": 3000, "remoting": { "context": false, "rest": { "handleerrors": false, "normalizehttppath": false, "xml": false }, "json": { "strict": false, "limit": 10485760 }, "urlencoded": { "extended": true, "limit": 10485760 }, "cors": false }, "legacyexplorer": false, "logoutsessionsonsensitivechanges": true }
i have tried updating in middleware.json
"parse": { "body-parser#json": { "limit": "52428800" }, "body-parser#urlencoded": { "params": { "extended": true }, "limit": "52428800" } },
Comments
Post a Comment