youngrrrr
By:
youngrrrr

Node request for certain site results in ETIMEDOUT error most of the time. Why??

April 1, 2016 884 views
Networking Node.js

I posted the following on StackOverflow as well, but figured it might be DigitalOcean-specific so I'm posting here as well.

===

Here's some background info on the system I'm running:

  • Ubuntu v 14.04

  • Node v4.4.0

  • Node request module v2.69.0

All of this on a DigitalOcean droplet/server.

 

So I run the following js file:

var request = require('request');

var url = 'http://www.example.com/';

console.log('requesting:', url);

request(url, function(err, res, body) { 
  if (err) {
    console.log(err);
    return;
  }

  console.log('body:', body);
});

On my droplet. Nearly 90% of the time I try this, I'll have to wait for several minutes before seeing the following:

{ [Error: connect ETIMEDOUT 12.34.56.78:80]
  code: 'ETIMEDOUT',
  errno: 'ETIMEDOUT',
  syscall: 'connect',
  address: '12.34.56.78',
  port: 80 }

I have no idea what's causing this. If I try hitting a different website like google.com (or anything else for that matter), I'll get a response almost immediately.

Furthermore, for this particular site, certain routes will work for some period of time... then stop working again. That is to say, the problem doesn't seem to be because I'm blocked from this particular site on my droplet.

On my own computer, running the js file for the given site won't result in any problems for me either... so I'm not sure why the problem is contained to my droplet.

Any pointers would be appreciated.

 

I attempted to diagnose the problem with traceroute. However, I have practically no knowledge of networks so I'm not sure how to proceed. This much is clear though - my connections are definitely not getting through:

traceroute to supremenewyork.com (52.5.44.158), 30 hops max, 60 byte packets
 1  45.55.192.254 (45.55.192.254)  8.903 ms  8.879 ms  8.865 ms
 2  162.243.188.229 (162.243.188.229)  1.028 ms 162.243.188.233 (162.243.188.233)  0.986 ms  1.004 ms
 3  xe-0-9-0-17.r08.nycmny01.us.bb.gin.ntt.net (129.250.204.113)  1.923 ms  1.918 ms nyk-b3-link.telia.net (62.115.45.5)  1.587 ms
 4  ae-11.amazon.nycmny01.us.bb.gin.ntt.net (129.250.201.138)  1.935 ms ae-10.amazon.nycmny01.us.bb.gin.ntt.net (129.250.201.134)  1.586 ms *
 5  nyk-b5-link.telia.net (213.155.131.137)  1.822 ms * *
 6  * * 62.115.32.130 (62.115.32.130)  1.361 ms
 7  * * *
 8  * * *
 9  * * *
10  54.239.110.157 (54.239.110.157)  33.817 ms * 54.239.110.133 (54.239.110.133)  27.683 ms
11  54.239.111.17 (54.239.111.17)  8.193 ms 205.251.244.128 (205.251.244.128)  7.883 ms 54.239.111.23 (54.239.111.23)  9.319 ms
12  205.251.245.55 (205.251.245.55)  8.253 ms 54.239.110.175 (54.239.110.175)  24.601 ms 205.251.244.195 (205.251.244.195)  8.250 ms
13  * 54.239.111.27 (54.239.111.27)  9.319 ms 54.239.111.29 (54.239.111.29)  9.290 ms
14  * * *
15  54.239.111.23 (54.239.111.23)  9.136 ms * *
16  * * *
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *
28  * * *
29  * * *
30  * * *

On the why, though, I'm definitely lacking.

1 Answer

I'm having this problem trying to deploy a Loopback/Strongloop. What did you do to solve the problem?

Have another answer? Share your knowledge.