Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PayloadTooLargeError: request entity too large #39

Closed
Anant13579 opened this issue Mar 28, 2019 · 2 comments
Closed

PayloadTooLargeError: request entity too large #39

Anant13579 opened this issue Mar 28, 2019 · 2 comments

Comments

@Anant13579
Copy link

Hi,

I receive following exception on offline-directline console whenever my bot returns large data (like images).

How may I resolve this issue ?

PayloadTooLargeError: request entity too large
at readStream (C:\Users\DEV1\AppData\Roaming\npm\node_modules\offline-directline\node_modules\raw-body\index.js:155:17)
at getRawBody (C:\Users\DEV1\AppData\Roaming\npm\node_modules\offline-directline\node_modules\raw-body\index.js:108:12)
at read (C:\Users\DEV1\AppData\Roaming\npm\node_modules\offline-directline\node_modules\body-parser\lib\read.js:77:3)
at jsonParser (C:\Users\DEV1\AppData\Roaming\npm\node_modules\offline-directline\node_modules\body-parser\lib\types\json.js:135:5)
at Layer.handle [as handle_request] (C:\Users\DEV1\AppData\Roaming\npm\node_modules\offline-directline\node_modules\express\lib\router\layer.js:95:5)
at trim_prefix (C:\Users\DEV1\AppData\Roaming\npm\node_modules\offline-directline\node_modules\express\lib\router\index.js:317:13)
at C:\Users\DEV1\AppData\Roaming\npm\node_modules\offline-directline\node_modules\express\lib\router\index.js:284:7
at Function.process_params (C:\Users\DEV1\AppData\Roaming\npm\node_modules\offline-directline\node_modules\express\lib\router\index.js:335:12)
at next (C:\Users\DEV1\AppData\Roaming\npm\node_modules\offline-directline\node_modules\express\lib\router\index.js:275:10)
at Function.handle (C:\Users\DEV1\AppData\Roaming\npm\node_modules\offline-directline\node_modules\express\lib\router\index.js:174:3)

Thanks.

@Anant13579
Copy link
Author

Does that require changes in bridge.ts file in the lines,
router.use(bodyParser.json()); // for parsing application/json
router.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded

to,
router.use(bodyParser.json(limit: '1mb')); // for parsing application/json
router.use(bodyParser.urlencoded({limit: '1mb', extended: true })); // for parsing application/x-www-form-urlencoded

to support 1 mb of data-size ?

@ryanvolum
Copy link
Owner

That's right! I'm using restify and bodyParser, which does have a lower default limit.

This bug in a peripheral package demonstrates the same solution:
apostrophecms/apostrophe#1291

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants