It seems your request take longer than default Koa timeout. Default Koa timeout is 2 minutes
I had similar problem one request take more time than 2 minutes.
I was inspirate by zeronone
commend in this post, and finally this line helped to me
ctx.request.socket.setTimeout(5 * 60 * 1000);
so whole code in router could look like
router.post('/long-request', async (ctx) => {
// set timeout to 5 minutes
ctx.request.socket.setTimeout(5 * 60 * 1000);
// do some stuf what take long time
// but less than 5 minutes
});
I really don't recommend do request what take longer than 1 minute, ideally run the heavy stuff on separate process and by other request just check if is the work done.
So that could be good just for testing purposes
DEBUG=*
and using app.onerror? You're trying to find the bad request, right? – Dragginghang up error
is thrown from the underlying nodejs socket. Maybereq.socket.setTimeout()
might help you increase the timeout. – Blanketyblank