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 #19

Open
perfectplug opened this issue Oct 5, 2021 · 3 comments
Open

PayloadTooLargeError: request entity too large #19

perfectplug opened this issue Oct 5, 2021 · 3 comments

Comments

@perfectplug
Copy link

C:\code\ast-hook-for-js-RE-master\src\api-server>node api-server.js
启动成功
PayloadTooLargeError: request entity too large
at readStream (C:\code\ast-hook-for-js-RE-master\node_modules\raw-body\index.js:155:17)
at getRawBody (C:\code\ast-hook-for-js-RE-master\node_modules\raw-body\index.js:108:12)
at read (C:\code\ast-hook-for-js-RE-master\node_modules\body-parser\lib\read.js:77:3)
at rawParser (C:\code\ast-hook-for-js-RE-master\node_modules\body-parser\lib\types\raw.js:81:5)
at Layer.handle [as handle_request] (C:\code\ast-hook-for-js-RE-master\node_modules\express\lib\router\layer.js:95:5)
at trim_prefix (C:\code\ast-hook-for-js-RE-master\node_modules\express\lib\router\index.js:317:13)
at C:\code\ast-hook-for-js-RE-master\node_modules\express\lib\router\index.js:284:7
at Function.process_params (C:\code\ast-hook-for-js-RE-master\node_modules\express\lib\router\index.js:335:12)
at next (C:\code\ast-hook-for-js-RE-master\node_modules\express\lib\router\index.js:275:10)
at expressInit (C:\code\ast-hook-for-js-RE-master\node_modules\express\lib\middleware\init.js:40:5)

请教大佬,这个问题需要如何解决

@CC11001100
Copy link
Member

node的http服务接受的请求体太大:
在这里:
https://github.com/CC11001100/ast-hook-for-js-RE/blob/1a5f1a4e6a76ad3f7627559d0a04af26d439fef1/src/api-server/api-server.js#L7-L15
增大限制,修改为:

app.use(bodyParser.raw({
    verify: function (req, res, buf, encoding) {
        if (buf && buf.length) {
            req.rawBody = buf.toString();
        }
    }, type: function () {
        return true
    },
    limit: "100MB"
}));

已知问题,会随后续版本修复。

@perfectplug
Copy link
Author

过于优秀

@perfectplug
Copy link
Author

完美的解决了我碰到的问题

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