ryanvolum / offline-directline

Unofficial package to emulate the bot framework connector locally.
https://www.npmjs.com/package/offline-directline
78 stars 44 forks source link

PayloadTooLargeError: request entity too large #39

Closed Anant13579 closed 5 years ago

Anant13579 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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: https://github.com/apostrophecms/apostrophe/issues/1291