You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This library times out the request but then still tries to return the response after the request already timed out. It's possible I'm using it wrong, but docs are very limited so it's hard to tell.
Basically I'm doing something like this:
import{Router}from'express';importtimeoutfrom'express-timeout-handler';constrouter=newRouter();router.use(timeout.handler({timeout: 60000,onTimeout: (req,res)=>{res.status(503).send('Service timed out');}});router.use('/myEndpoint',timeout.set(5000),bodyParser.json(),(req,res)=>{// make a call to another service here and return result});
I have an unhandledReject handler that picks up this:
UNHANDLED REJECTION: Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client.
The text was updated successfully, but these errors were encountered:
Hi @scottc-netflix . It's not possible to replicate this unless you show us what happens inside the /myEndpoint handler. More specifically you need to show us all methods which are accessed on the res object (for example doing res.json(...)).
This library times out the request but then still tries to return the response after the request already timed out. It's possible I'm using it wrong, but docs are very limited so it's hard to tell.
Basically I'm doing something like this:
I have an unhandledReject handler that picks up this:
UNHANDLED REJECTION: Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client.
The text was updated successfully, but these errors were encountered: