Api.twitch.tv/kraken/streams/ endpoint unstable

I’m stealing the term throttleneck for unruly individuals.

1 Like

i fixed the typo after i googled what it meant. Sorry for that-.

I am actually seeing this as well. I check once a minute. I am 5 minutes plus now where a user is offline according to the API endpoint. He has been live for 2 hours now, this isn’t an issue where he just went live and we don’t see him online yet. He was live and the API is showing him as offline even though he is not.

2 Likes

@betz0r and @Santa, are you still seeing this regularly? I’ve been working with the API team responsible for this endpoint, and they’ve been implementing some changes to help scale it.

Hey @DallasNChains

I’ve been experiencing this recently as well.
For me, it began about a week ago where an endpoint for a streamer would return a null stream, but it would be okay moments later.

@DallasNChains thx for your response, i am still seeing the issue but less frequent and not all streams fail at the same time

for june i got a few 503 errors and some timeouts (UTC+2):

grep -R “twitch.php” log-2016-06*
log-2016-06-01.php:ERROR - 2016-06-01 01:55:09 --> twitch.php: 0 503
log-2016-06-01.php:ERROR - 2016-06-01 14:19:29 --> twitch.php: 28 0 Connection timed out after 10001 milliseconds
log-2016-06-01.php:ERROR - 2016-06-01 14:19:29 --> twitch.php: 28 0 Connection timed out after 10001 milliseconds
log-2016-06-01.php:ERROR - 2016-06-01 23:06:31 --> twitch.php: 0 503
log-2016-06-02.php:ERROR - 2016-06-02 22:07:09 --> twitch.php: 0 503
log-2016-06-02.php:ERROR - 2016-06-02 22:15:21 --> twitch.php: 0 503
log-2016-06-03.php:ERROR - 2016-06-03 01:11:19 --> twitch.php: 0 503

the other part is the stream is offline but online problem, which still exists in my eyes:

grep -R “offline with data” log-2016-06*
log-2016-06-01.php:DEBUG - 2016-06-01 07:48:31 --> stream offline with data in last 5 minutes smerlowtv
log-2016-06-01.php:DEBUG - 2016-06-01 08:27:12 --> stream offline with data in last 5 minutes smerlowtv
log-2016-06-01.php:DEBUG - 2016-06-01 11:21:29 --> stream offline with data in last 5 minutes smerlowtv
log-2016-06-01.php:DEBUG - 2016-06-01 14:22:51 --> stream offline with data in last 5 minutes smerlowtv
log-2016-06-01.php:DEBUG - 2016-06-01 14:47:40 --> stream offline with data in last 5 minutes smerlowtv
log-2016-06-01.php:DEBUG - 2016-06-01 15:02:50 --> stream offline with data in last 5 minutes cillidbaaang
log-2016-06-01.php:DEBUG - 2016-06-01 15:22:27 --> stream offline with data in last 5 minutes smerlowtv
log-2016-06-01.php:DEBUG - 2016-06-01 15:42:41 --> stream offline with data in last 5 minutes smerlowtv

it definetly got better but as you can see there is a pattern for some calls that still show offline but stream is indeed online. the timestamps show if its happening it happens around every 20mins,

the problem is if i log every occuring stream:NULL response, i can’t differ whether an logentry is done becaue the stream is really offline and my “app” is running for this particular streamer or whether just twitch api failed and the stream is still live with my app running. the logentry looks the same and that makes it hard to rely whether the stream is live or not just because this endpoint fails.

another solution for this issue would be to provide a new endpoint for the live status, for example pulling live status directly from ingest infrastructure and GET /kraken/livestatus/:channel with an example reponse: status:true/false and maybe last occurring timestamp of statuschange.

some more problems this morning: stream is still live (utc+2 9:00) and was never offline.

UTC+2
ERROR - 2016-06-06 08:54:26 --> stream offline xhackforeverxdx with data in last minute
ERROR - 2016-06-06 08:54:10 --> stream offline xhackforeverxdx with data in last minute
ERROR - 2016-06-06 08:53:55 --> stream offline xhackforeverxdx with data in last minute
ERROR - 2016-06-06 08:49:48 --> stream offline xhackforeverxdx with data in last minute
ERROR - 2016-06-06 08:49:33 --> stream offline xhackforeverxdx with data in last minute
ERROR - 2016-06-06 08:49:17 --> stream offline xhackforeverxdx with data in last minute
ERROR - 2016-06-06 08:39:32 --> stream offline xhackforeverxdx with data in last minute
ERROR - 2016-06-06 08:39:16 --> stream offline xhackforeverxdx with data in last minute
ERROR - 2016-06-06 08:39:00 --> stream offline xhackforeverxdx with data in last minute
ERROR - 2016-06-06 08:24:52 --> stream offline xhackforeverxdx with data in last minute
ERROR - 2016-06-06 08:24:36 --> stream offline xhackforeverxdx with data in last minute
ERROR - 2016-06-06 08:24:21 --> stream offline xhackforeverxdx with data in last minute
ERROR - 2016-06-06 08:19:12 --> stream offline xhackforeverxdx with data in last minute
ERROR - 2016-06-06 08:18:56 --> stream offline xhackforeverxdx with data in last minute
ERROR - 2016-06-06 08:18:41 --> stream offline xhackforeverxdx with data in last minute
ERROR - 2016-06-06 08:09:56 --> stream offline xhackforeverxdx with data in last minute
ERROR - 2016-06-06 08:09:40 --> stream offline xhackforeverxdx with data in last minute
ERROR - 2016-06-06 08:09:24 --> stream offline xhackforeverxdx with data in last minute
ERROR - 2016-06-06 07:59:55 --> stream offline xhackforeverxdx with data in last minute
ERROR - 2016-06-06 07:59:39 --> stream offline xhackforeverxdx with data in last minute
ERROR - 2016-06-06 07:59:23 --> stream offline xhackforeverxdx with data in last minute
ERROR - 2016-06-06 07:54:15 --> stream offline xhackforeverxdx with data in last minute
ERROR - 2016-06-06 07:53:59 --> stream offline xhackforeverxdx with data in last minute
ERROR - 2016-06-06 07:53:43 --> stream offline xhackforeverxdx with data in last minute

This is a known issue for me with the /streams?offset=0&limit=100&channel=.. endpoint. Sometimes a stream object for the channels I requested will be missing, even though it’s in the middle of the stream.

I’m using this clientside in a chat client, and it tells the user about the stream being offline, so that is a source of confusion for many people who don’t know that it can sometimes report a wrong status. I added a secondary check after at least 10 seconds to verify that the stream is offline, which probably catches about 50% of these occurences before showing the wrong status to the user.

Since it’s clientside I can only rely on my own personal logs, it seems to be happening occasionally. I don’t request the endpoint that often though, only every few minutes.

Finally i got a screenshot of twitch.tv during an api fail:

The image shows the chat is active, the offline overlay is visible but viewercount (cached?) is displayed. the channel was live during this screenshot and for abount 5minutes refreshing the page and trying to start to play the stream didn’t work, so basically the stream was not watchable for me at this time but the stream was live.

1 Like

Just an update, I’m still looking into this. Sorry for the wait!

1 Like

I’m having problems that the endpoint is not displaying the delay! Is this related?

null values for the delay? I can confirm I’m seeing this too, but I’m not familiar with the delay values, so I’m not sure if this is expected behavior.

Delay = null (or any other field = null) means the field has never been set by the user. The value can be assumed to be the default (for delay, it’s 0 [seconds]). Null allows you to differentiate between ‘never set’ and ‘not enabled’

That makes sense, thanks. I’m not seeing anything out of the ordinary with delay then.

Just to add to this, I noticed a similar hiccup in a Discord bot that I manage this past Sunday ( June 12th)

For now, all it does is a simple @here announcement for when the streamer goes live and then a “Thanks for watching” message when it polls that he’s gone offline, using the usual ~/streams endpoint and parsing out the contents (or lack thereof) of the streams[] id…

I poll at a very generous 1 call/7 minutes, and it pulled a null value for the response at 5:02 PM EST when he had been streaming since 2PM EST and didn’t actually go offline until around 8PM EST

Another quick update here. We’ve added some sampling code to this endpoint and are collecting data now. Once I’m back from E3 and get to delve into the data, I will be having discussions with the team that own this API to see how we can fix the problem. As always, I’ll keep you posted. :slight_smile:

3 Likes

Today we experienced another “downtime”, but it is unrelated to this issues origin.

https://api.twitch.tv/kraken/streams?channel=SirBerlinStyle online
https://api.twitch.tv/kraken/streams?channel=sirberlinstyle online
https://api.twitch.tv/kraken/streams/SirBerlinStyle online
https://api.twitch.tv/kraken/streams/sirberlinstyle offline

I guess we have a case sensitive issue here.

1 Like

Thats interesting because I would assume the endpoint would be looking at the name, not the display_name. You think it could be a coincidence, perhaps their cache keys are case sensitive?

That seems to be the case,

https://api.twitch.tv/kraken/streams/lirik
shows a different viewer count than
https://api.twitch.tv/kraken/streams/liriK
for me

I am seeing users drop with name or display name. Makes no difference.