Closed jaythakor-ai closed 1 year ago
Hi @jaythakor-ai, we need a reproduction scenario to investigate. Either as a test case, or as a full app example that reproduces the issue.
Here is the code. We are trying to load a test on post API from Jmeter. Issue occurred and its failed most of the APIs @endel
var uWebSockets_js_1 = require("uWebSockets.js");
var uwebsockets_express_1 = require("uwebsockets-express");
var uwsApp = uWebSockets_js_1.App();
var app = (0, uwebsockets_express_1.default)(uwsApp);
var compression = require('compression');
app.use(compression({ filter: shouldCompress }))
function shouldCompress(req, res) {
if (req.headers['x-no-compression']) {
// don't compress responses with this request header
return false
}
// fallback to standard filter function
return compression.filter(req, res)
}
http.createServer(function (req, res) {
app(req, res); /*loggerMod(req, res);*/
});`
app.listen(1880, function (err) {
if (err) {
log.error(log._("server.unable-to-listen", { }));
} else {
// register routes
app.get("/test_endpoint", function (req, res) {
res.json({ hello: "world!" });
});
uwsApp.get('/internal_healthcheck', (res, req) => {
res.writeStatus('200 OK').writeHeader('IsAlive', 'Yes').end('{"status":"active","time":"' + Date.now() + '"}');
})
app.get('/healthcheck', (req, res) => {
res.setHeader('Content-Type', 'application/json');
res.send('{"status":"active","time":"' + Date.now() + '"}');
});
app.post("/postAPI", auth.needsPermission("nodes.read"), (req, res)=> {
//here get an error (not every time, sometimes), currently we are load test on this API with jmeter
});
}
@endel Please note that this error only comes when the request payload size is big. In our case, payload size is 34 kb. The uwebsocket-express version we are using is 1.3.1.
Hi @endel any updates on this?? We are block on it.
Thanks for the pull-request.
@endel Welcome!
Description
I just replaced the express server with the uwebsocket-epxress. I am getting "request size did not match content length" for some of the our APIs. And those APIs are working fine with express. Anyone have chance to looked into it? It is blocking some of the priority Task. Thanks in advance :)