Random connection refuses from streams API endpoint (V5)


I’ve been trying to make NodeJS based Update/Caching system for streamers we would like to “advertise” in our community website and so on and it has worked before fluently when all of the users were inside one API call but as the “New API” was announced we wanted to adapt to this new limit of 100 users for each request but now we’ve been bumping into this same issue more than once within 24 hours time frame.

The issue I’m having is the following which I keep getting as error message:
“Error: connect ECONNREFUSED”

This issue seems to be random but still I get this message about 2-4 times in a day like mentioned before and it cannot be rate limit based issue as the project is pulling 100 ID chunks every 19.5 seconds and those IDs are different each request and each chunk is connected to one request URL.
There has been rare times that we’ve managed to go over 24 hours but it has gone to same error after 48 hours max.

The URL which I’m using is https://api.twitch.tv/kraken/streams/?limit=100&channel=

What could cause this issue?

Whatever the problem may be, it’s probably not on your side. Alternatively, you can try the helix endpoint and see if you get better results.

I would check your hosting provider too, to see if they are blocking outbound requests they are erroneously detecting as “spam”/malicious/ddosy since you are making a lot of requests.

Hi BarryCarlyon,

Well I have checked and that is not the case as those “block” looking refusals last from 15 seconds to 1 minute and then continues without an issue.

Made some more error handling to just wait for another loop execution if the case is load balancing in Twitch side or some random blackout refusing from CloudFlare so it no longer crashes but it was something I wanted to ask if there was actual reason why that is happening as if it’s intentional or something else.

Also they would notice if it was ddosy or something regarding what you mentioned but this doesn’t seem to be the case because if they would flag it as “threat” the connection refuse would last at least from one hour to several hours and not from seconds to minutes.

Afaik Twitch doesn’t use cloudflare, so if you are seeing that in your stack then something weird is going on.

Might just be a bad server in the DNS round robin that not been removed but if you are seeing it consistently (on the same server) then thats a weird one.

Agreed, but different people configure different things differently and thus set a different time out or block.

it might just be something as simple as a server having it’s time out of date, but that would thru a SSL error over a connection error.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.