Thursday, 11 May 2017

How to debug request-promise which fail without any error

I'm running Debian 6 with NodeJS6 and request-promise. I'm using request-promise to deliver web hooks. Currently, we are delivering around 2+M web hooks each day.

Most of the time everything runs fine, but there are cases where the HTTP request simply isn't delivered.

This is my simple code:

requestPromise({ url: 'https://change-iot-request/do', auth: { user: "switch", pass: "my-password" }, method: "GET", timeout: 15000, rejectUnauthorized: false})
.catch(function(err) {
    console.log(err);
});

Sometimes the endpoint simply doesn't receive anything, and there's no output. I've tried to run tshark to see if packages came through - nothing on any of the servers.

If I when it occurs run curl command with the same parameters the request DOES come through.

And if I restart the NodeJS it starts to deliver correctly again. My problem is when the situation occurs there's no error to debug with.

What to do?



via Michael Nielsen

No comments:

Post a Comment