node-yahoo-finance icon indicating copy to clipboard operation
node-yahoo-finance copied to clipboard

Failed to get crumb (Error: connect ETIMEDOUT)

Open adams-family opened this issue 4 years ago • 6 comments

Started getting the following error today:

Failed to get crumb (Error: connect ETIMEDOUT 87.248.107.204:443)

How to reproduce:

yahooFinance.quote({
	symbol: 'TSLA',
	modules: ['price']
}, function (err, result) {
	if (err) {
		reject('ERROR:', err);
	} else {
		console.log('SUCCESS:', result)
	}
});

I noticed that I can't even curl to yahoo:

curl https://finance.yahoo.com

  • Curl to finance.yahoo.com works fine from another machine.
  • Curl to other addresses (such as www.yahoo.com) works fine from the affected machine as well.

Maybe this library gets banned by Yahoo over time?

adams-family avatar Mar 17 '20 07:03 adams-family

Just in case it helps anyone, I figured out a workaround, although I'm not absolutely happy with it:

On the wrong machine finance.yahoo.com resolved to 87.248.107.204

On the good machine finance.yahoo.com resolved to 87.248.114.11

Therefore I was able to make it work by setting up a custom record into the /etc/hosts file:

87.248.114.11 finance.yahoo.com query1.yahoo.com query2.yahoo.com

I think it had nothing to do with a ban from Yahoo but rather an outage. Can anyone confirm?

adams-family avatar Mar 17 '20 08:03 adams-family

Hi yes this sounds like nothing to do with the library specifically.

In the worst case, perhaps they are indeed trying to curtail requests origination from hosting providers, but probably it's either a CDN issue their side, or, considering how long it's been going on, more likely a DNS issue on your side.

Where are the two machines? What are their DNS settings? Do they have their own DNS caches that can be reset? Any possibility of stale cache also at interim DNS servers?

gadicc avatar Mar 17 '20 11:03 gadicc

Hi, yes, I agree, I also think that it had nothing to do with the library in the end. I wanted to report it just in case some new restrictions were put in placed by Yahoo - but it seems that it an outage of Yahoo's servers.

The affected machines are in the Czech Republic, DNS is 1.1.1.1. The working machine is in Austria, DNS is 1.1.1.1.

I think that Yahoo might use different servers for the two regions either for geo-balancing or they might have just changed the IP in the meantime.

I plan to remove the record from /etc/hosts in about a day from now and see if the problem occurs again.

adams-family avatar Mar 17 '20 12:03 adams-family

I suddenly get the same problem since a few days and can't figure it out. Will try a few suggestions from @adams-family now

codeofsumit avatar Jun 14 '20 17:06 codeofsumit

87.248.114.11 finance.yahoo.com query1.yahoo.com query2.yahoo.com

This solution works. Thanks a lot @adams-family

codeofsumit avatar Jun 14 '20 19:06 codeofsumit

Not workling for me. Just trying the example code. Still not able to get any data with node-yahoo-api Unhandled Rejection (Error): Failed to get crumb (TypeError: NetworkError when attempting to fetch resource.)

debegr92 avatar Apr 29 '21 04:04 debegr92