Closed misha-panyushkin closed 2 months ago
Try omitting lws-body-parser from the stack..
if you run this command you'll see the default middleware stack (the list of middleware plugins that are active by default):
$ ws --default-stack
[
'lws-basic-auth',
'lws-body-parser',
'lws-request-monitor',
'lws-log',
'lws-cors',
'lws-json',
'lws-compress',
'lws-rewrite',
'lws-blacklist',
'lws-conditional-get',
'lws-mime',
'lws-range',
'lws-spa',
'lws-static',
'lws-index'
]
To omit lws-body-parser (which i suspect is causing the issue) from the middleware stack, run this command (i skipped the lws-
prefix from each plugin name - it is optional):
$ ws --stack basic-auth request-monitor log cors json compress rewrite blacklist conditional-get mime range spa static index
Let me know if that fixes the issue.
@75lb your approach helped me, many thanks! It should be mentioned that prior to run your code, I grabbed the latest version of lws
.
OK, I'm glad we isolated the issue. However, I still need to fix lws-body-parser.
I'll look into adding a new option which increases the maximum size of files supported by body-parser. Let me know if you find any other issues! 👍
@75lb option for increasing size will be great!
P.S. It will be good to have an exclude flag for stack middleware also.
Excluding flag is a great idea. And a option for increasing the limit would be nice, either.
Still needing help on this?
yes, both features are required - I will write some instructions later.. In the meantime, feel free to try some ideas!
Fixed and released in local-web-server v5.4.0
Middleware error
PayloadTooLargeError: request entity too large at readStream
The transferred entity is 42Mb, so how could I increase amount of transferred data via lws config?
Error message:
Middleware error PayloadTooLargeError: request entity too large at readStream (/usr/local/lib/node_modules/local-web-server/node_modules/raw-body/index.js:155:17) at executor (/usr/local/lib/node_modules/local-web-server/node_modules/raw-body/index.js:112:5) at new Promise (<anonymous>) at getRawBody (/usr/local/lib/node_modules/local-web-server/node_modules/raw-body/index.js:111:10) at /usr/local/lib/node_modules/local-web-server/node_modules/co-body/lib/json.js:41:14 at process._tickCallback (internal/process/next_tick.js:68:7)