needle icon indicating copy to clipboard operation
needle copied to clipboard

open_timeout seems to be blocking

Open andrewlight13 opened this issue 4 years ago • 2 comments

I've got a needle request to a service that sometimes takes a long time to respond, occasionally exceeding the open_timeout limit of 10 seconds. However, when it does so, no error is thrown, and the program seems to block on this line:

needle.defaults({
    open_timeout: 10000,
});
let response;
try{
    response = await needle('get', requestUrl, await this.getAuthHeaders());
    console.log("await completed");
}catch(err){
    console.error(err);
}

if open_timeout is triggered, Chrome reports that the connection was cancelled, but neither the console.log statement nor the console.error statement are triggered. Am I missing some other method of handling this timeout, or is this a bug?

andrewlight13 avatar May 29 '20 19:05 andrewlight13

I have a similar issue. In some cases a http/https request doesn't response neither with a success nor an error. So it's also blocking the complete script. The only difference between your code and mine is that i'm using proxy settings.

cpietsch82 avatar Jul 22 '20 14:07 cpietsch82

Did you set response_timeout? Server can accept your request but hold response.

puzrin avatar Nov 03 '20 01:11 puzrin