hapi
hapi copied to clipboard
I always got a timeout error after request completion.
I send a request in Chrome and got the response correctly. But I always got a timeout error after about 2 minutes in the server terminal. I only got error in node 18 and windows 10, if I use node 16 there is no error.
[10:52:22.928] ERROR (16820): Request timeout
tags: [
"connection",
"client",
"error"
]
err: {
"type": "Error",
"message": "Request timeout",
"stack":
Error [ERR_HTTP_REQUEST_TIMEOUT]: Request timeout
at new NodeError (node:internal/errors:399:5)
at onRequestTimeout (node:_http_server:787:30)
at Server.checkConnections (node:_http_server:600:7)
at listOnTimeout (node:internal/timers:569:17)
at process.processTimers (node:internal/timers:512:7)
"code": "ERR_HTTP_REQUEST_TIMEOUT"
}
Support plan
- is this issue currently blocking your project? (yes):
- is this issue affecting a production system? (yes):
Context
- node version: v18.15.0
- module version: 21.3.1
- environment (e.g. node, browser, native): Windows 10, Chrome
- used with (e.g. hapi application, another framework, standalone, ...): hapi-pino 12.0.0
- any other relevant information:
"dependencies": {
"@hapi/boom": "^10.0.1",
"@hapi/hapi": "^21.3.1",
"@hapi/inert": "^7.1.0",
"@hapi/vision": "^7.0.1",
"dotenv": "^16.0.3",
"echarts": "^5.4.2",
"hapi-pino": "^12.0.0",
"hapi-swagger": "^16.0.1",
"joi": "^17.9.1",
"pino-pretty": "^10.0.0"
},
"devDependencies": {
"@hapi/code": "^9.0.3",
"@hapi/lab": "^25.1.2",
"eslint": "^8.38.0",
"nodemon": "^2.0.22"
}
How can we help?
This is a demo.
"use strict";
const Hapi = require("@hapi/hapi");
const init = async () => {
const server = Hapi.server({
port: 8080,
host: "0.0.0.0",
});
await server.register({
plugin: require("hapi-pino"),
options: {
transport: {
target: "pino-pretty",
},
logRequestComplete: true,
},
});
server.route({
method: "GET",
path: "/",
handler: (request, h) => {
return "Hello Hapi!";
},
});
await server.start();
console.log("Server running on %s", server.info.uri);
};
process.on("unhandledRejection", (err) => {
console.log(err);
process.exit(1);
});
init();