question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PayloadTooLargeError: request entity too large when trying to POST to apostrophe-headless API

See original GitHub issue

I am using apostrophe-headless, and my payloads are slightly big since I am storing images as base64 strings, so some of the requests fail with this:

PayloadTooLargeError: request entity too large
    at readStream (/Users/marjan/Projects/marketplace-backend/node_modules/raw-body/index.js:155:17)
    at getRawBody (/Users/marjan/Projects/marketplace-backend/node_modules/raw-body/index.js:108:12)
    at read (/Users/marjan/Projects/marketplace-backend/node_modules/body-parser/lib/read.js:77:3)
    at jsonParser (/Users/marjan/Projects/marketplace-backend/node_modules/body-parser/lib/types/json.js:134:5)
    at Layer.handle [as handle_request] (/Users/marjan/Projects/marketplace-backend/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/Users/marjan/Projects/marketplace-backend/node_modules/express/lib/router/index.js:317:13)
    at /Users/marjan/Projects/marketplace-backend/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/Users/marjan/Projects/marketplace-backend/node_modules/express/lib/router/index.js:335:12)
    at next (/Users/marjan/Projects/marketplace-backend/node_modules/express/lib/router/index.js:275:10)
    at urlencodedParser (/Users/marjan/Projects/marketplace-backend/node_modules/body-parser/lib/types/urlencoded.js:100:7)
    at Layer.handle [as handle_request] (/Users/marjan/Projects/marketplace-backend/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/Users/marjan/Projects/marketplace-backend/node_modules/express/lib/router/index.js:317:13)
    at /Users/marjan/Projects/marketplace-backend/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/Users/marjan/Projects/marketplace-backend/node_modules/express/lib/router/index.js:335:12)
    at next (/Users/marjan/Projects/marketplace-backend/node_modules/express/lib/router/index.js:275:10)
    at self.csrf (/Users/marjan/Projects/marketplace-backend/node_modules/apostrophe/lib/modules/apostrophe-express/index.js:447:16)

I tried setting apostrophe-express.bodyParser to {limit: '50mb', extended: true}, but that doesn’t seem to work.

Any ideas on how to increase the request size limit?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:20 (3 by maintainers)

github_iconTop GitHub Comments

141reactions
marjan-georgievcommented, Mar 24, 2018

This seems to have worked:

bodyParser = {
  json: {limit: '50mb', extended: true},
  urlencoded: {limit: '50mb', extended: true}
};
81reactions
moshepeledcommented, Jul 22, 2018

better use (you can change the limit of data as you wish - for example 10mb):

app.use(bodyParser.json({limit: ‘10mb’, extended: true})) app.use(bodyParser.urlencoded({limit: ‘10mb’, extended: true}))

Read more comments on GitHub >

github_iconTop Results From Across the Web

PayloadTooLargeError: request entity too large - Stack Overflow
So I tried these 3 solutions. 1. app.use(bodyParser.json({limit: '50mb'})); ...
Read more >
Error: PayloadTooLargeError: request entity too large in BotKit
Some users have reported they faced issues in botkit. Error: PayloadTooLargeError: request entity too large
Read more >
Payloadtoolargeerror request entity too large
apostrophe PayloadTooLargeError : request entity too large when trying to POST to apostrophe-headless API I am using apostrophe-headless, and my payloads are ...
Read more >
Extensions and Integrations - ApostropheCMS
Adds REST APIs to ApostropheCMS pieces and pages, powering React/Vue/etc apps with a headless CMS. Repository: apostrophecms/apostrophe-headless; npm ...
Read more >
Nestjs 413 Payload Too Large Multipart - ADocLib
Source: stackoverflow.com PayloadTooLargeError: request entity too large using express json react chunk file too large. upload and send file to axios ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found