twitchdev / issues

Issue tracker for third party developers.
Apache License 2.0
72 stars 7 forks source link

Helix incorrectly shows streaming channel as down #250

Open aeturnum opened 3 years ago

aeturnum commented 3 years ago

Brief description I noticed this bug testing Twitch Streaming Webhooks. I will get a stream up notification, then very quickly after a stream down notification, though I have not stopped streaming.

I can easily confirm that this is a Helix bug because the V5 API shows the stream as up. My user_id is 503254 (as can be seen in the logs below)

Posting here based on advice from API forums: https://discuss.dev.twitch.tv/t/v5-api-correctly-shows-stream-is-up-but-helix-says-it-is-down/28877/2

How to reproduce 1) Start streaming 2) Wait an indeterminate period until twitch believes the stream has stopped 3) Try api requests:

Httpie requests to V5 and Helix APIs showing difference ``` ddrexler@Drexbook-Pro:conmon|$ http -v 'https://api.twitch.tv/kraken/streams/503254?stream_type=live' Client-Id:****************************** Authorization:"Bearer ******************************" Accept:application/vnd.twitchtv.v5+json GET /kraken/streams/503254?stream_type=live HTTP/1.1 Accept: application/vnd.twitchtv.v5+json Accept-Encoding: gzip, deflate Authorization: Bearer ****************************** Client-Id: ****************************** Connection: keep-alive Host: api.twitch.tv User-Agent: HTTPie/2.2.0 HTTP/1.1 200 OK Access-Control-Allow-Origin: * Cache-Control: no-cache, no-store, must-revalidate, private Connection: keep-alive Content-Length: 1287 Content-Type: application/json; charset=utf-8 Date: Mon, 02 Nov 2020 19:08:32 GMT Expires: 0 Pragma: no-cache Strict-Transport-Security: max-age=300 Timing-Allow-Origin: https://www.twitch.tv Vary: Accept-Encoding X-Cache: MISS, MISS X-Cache-Hits: 0, 0 X-Served-By: cache-sea4446-SEA, cache-sjc10023-SJC X-Timer: S1604344113.782850,VS0,VS0,VE45 { "stream": { "_id": 40320599246, "average_fps": 30, "broadcast_platform": "live", "channel": { "_id": 503254, "broadcaster_language": "en", "broadcaster_software": "", "broadcaster_type": "", "created_at": "2008-04-28T10:16:22.519482Z", "description": "Watch me be bad", "display_name": "aeturnum", "followers": 11, "game": "World of Warcraft", "language": "en", "logo": "https://static-cdn.jtvnw.net/jtv_user_pictures/aeturnum-profile_image-e52423744803803f-300x300.jpeg", "mature": false, "name": "aeturnum", "partner": false, "privacy_options_enabled": false, "private_video": false, "profile_banner": null, "profile_banner_background_color": "", "status": "Wow TBC Atlantiss", "updated_at": "2020-11-02T18:51:41.203231Z", "url": "https://www.twitch.tv/aeturnum", "video_banner": null, "views": 437 }, "community_id": "", "community_ids": [], "created_at": "2020-11-02T18:34:44Z", "delay": 0, "game": "World of Warcraft", "is_playlist": false, "preview": { "large": "https://static-cdn.jtvnw.net/previews-ttv/live_user_aeturnum-640x360.jpg", "medium": "https://static-cdn.jtvnw.net/previews-ttv/live_user_aeturnum-320x180.jpg", "small": "https://static-cdn.jtvnw.net/previews-ttv/live_user_aeturnum-80x45.jpg", "template": "https://static-cdn.jtvnw.net/previews-ttv/live_user_aeturnum-{width}x{height}.jpg" }, "stream_type": "live", "video_height": 1080, "viewers": 1 } } ddrexler@Drexbook-Pro:conmon|$ http -v 'https://api.twitch.tv/helix/streams?user_id=503254' Client-Id:****************************** Authorization:"Bearer ******************************" GET /helix/streams?user_id=503254 HTTP/1.1 Accept: */* Accept-Encoding: gzip, deflate Authorization: Bearer ****************************** Client-Id: ****************************** Connection: keep-alive Host: api.twitch.tv User-Agent: HTTPie/2.2.0 HTTP/1.1 200 OK Access-Control-Allow-Origin: * Cache-Control: no-cache, no-store, must-revalidate, private Connection: keep-alive Content-Length: 27 Content-Type: application/json; charset=utf-8 Date: Mon, 02 Nov 2020 19:08:43 GMT Expires: 0 Pragma: no-cache Ratelimit-Limit: 800 Ratelimit-Remaining: 799 Ratelimit-Reset: 1604344124 Strict-Transport-Security: max-age=300 Timing-Allow-Origin: https://www.twitch.tv Twitch-Trace-Id: a2192f16be752294b9766cf3d2c96c52 Vary: Accept-Encoding X-Cache: MISS, MISS X-Cache-Hits: 0, 0 X-Ctxlog-Logid: 1-5fa0593b-2a00335f697aff2c181ad4a8 X-Served-By: cache-sea4466-SEA, cache-sjc10068-SJC X-Timer: S1604344123.049030,VS0,VS0,VE49 { "data": [], "pagination": {} } ```

Expected behavior Both APIs would show the stream as up.

Additional context or questions It's entirely possible that I'm using the Helix API incorrectly, but I don't see how. I will leave my stream of the home page of Microsoft Edge live so others can test.

lleadbet commented 3 years ago

Hi @aeturnum - are you seeing the stream as offline after the webhook, or is it still marked as live in the Helix API?

aeturnum commented 3 years ago

Hey @lleadbet,

It seems like, after a brief initial period where both APIs see my account as streaming, they separate.

Here's a sample timeline from just now:

~9:38:00 PST - Start stream
09:38:27 PST - Server gets a webhook from twitch servers telling me the stream is up with the streaming payload as expected
09:38:49 PST - Server gets a 2nd webhook from twitch servers telling me the stream is down (the stream is not down)

I don't think it's always 30s, but pretty quickly the helix and kraken APIs start having different opinions. Helix thinks I'm not streaming and Kraken thinks I am.

Here's another set of httpie requests:

Logs from ~9:38 ddrexler@Drexbook-Pro:conmon|$ http -v 'https://api.twitch.tv/helix/streams?user_id=503254' Client-Id:****************************** Authorization:"Bearer ******************************" GET /helix/streams?user_id=503254 HTTP/1.1 Accept: */* Accept-Encoding: gzip, deflate Authorization: Bearer ****************************** Client-Id: ****************************** Connection: keep-alive Host: api.twitch.tv User-Agent: HTTPie/2.3.0 HTTP/1.1 200 OK Access-Control-Allow-Origin: * Cache-Control: no-cache, no-store, must-revalidate, private Connection: keep-alive Content-Length: 27 Content-Type: application/json; charset=utf-8 Date: Sun, 15 Nov 2020 05:39:21 GMT Expires: 0 Pragma: no-cache Ratelimit-Limit: 800 Ratelimit-Remaining: 799 Ratelimit-Reset: 1605418762 Strict-Transport-Security: max-age=300 Timing-Allow-Origin: https://www.twitch.tv Twitch-Trace-Id: 00e55824e4dec027bc0721b333e9b780 Vary: Accept-Encoding X-Cache: MISS, MISS X-Cache-Hits: 0, 0 X-Ctxlog-Logid: 1-5fb0bf09-30695e332f5a6ce71ef917d7 X-Served-By: cache-sea4433-SEA, cache-bur17543-BUR X-Timer: S1605418761.995473,VS0,VS0,VE57 { "data": [], "pagination": {} } ddrexler@Drexbook-Pro:conmon|$ http -v 'https://api.twitch.tv/kraken/streams/503254?stream_type=live' Client-Id:****************************** Authorization:"Bearer ******************************" Accept:application/vnd.twitchtv.v5+json GET /kraken/streams/503254?stream_type=live HTTP/1.1 Accept: application/vnd.twitchtv.v5+json Accept-Encoding: gzip, deflate Authorization: Bearer ****************************** Client-Id: ****************************** Connection: keep-alive Host: api.twitch.tv User-Agent: HTTPie/2.3.0 HTTP/1.1 200 OK Access-Control-Allow-Origin: * Cache-Control: no-cache, no-store, must-revalidate, private Connection: keep-alive Content-Length: 1268 Content-Type: application/json; charset=utf-8 Date: Sun, 15 Nov 2020 05:39:24 GMT Expires: 0 Pragma: no-cache Strict-Transport-Security: max-age=300 Timing-Allow-Origin: https://www.twitch.tv Vary: Accept-Encoding X-Cache: MISS, MISS X-Cache-Hits: 0, 0 X-Served-By: cache-sea4425-SEA, cache-bur17546-BUR X-Timer: S1605418764.999472,VS0,VS0,VE58 { "stream": { "_id": 40495509070, "average_fps": 30, "broadcast_platform": "live", "channel": { "_id": 503254, "broadcaster_language": "en", "broadcaster_software": "", "broadcaster_type": "", "created_at": "2008-04-28T10:16:22.519482Z", "description": "Watch me be bad", "display_name": "aeturnum", "followers": 11, "game": "World of Warcraft", "language": "", "logo": "https://static-cdn.jtvnw.net/jtv_user_pictures/aeturnum-profile_image-e52423744803803f-300x300.jpeg", "mature": false, "name": "aeturnum", "partner": false, "privacy_options_enabled": false, "private_video": false, "profile_banner": null, "profile_banner_background_color": "", "status": "Wow TBC Atlantiss", "updated_at": "2020-11-02T19:27:04.653125Z", "url": "https://www.twitch.tv/aeturnum", "video_banner": null, "views": 439 }, "community_id": "", "community_ids": [], "created_at": "2020-11-15T05:37:45Z", "delay": 0, "game": "", "is_playlist": false, "preview": { "large": "https://static-cdn.jtvnw.net/previews-ttv/live_user_aeturnum-640x360.jpg", "medium": "https://static-cdn.jtvnw.net/previews-ttv/live_user_aeturnum-320x180.jpg", "small": "https://static-cdn.jtvnw.net/previews-ttv/live_user_aeturnum-80x45.jpg", "template": "https://static-cdn.jtvnw.net/previews-ttv/live_user_aeturnum-{width}x{height}.jpg" }, "stream_type": "live", "video_height": 1080, "viewers": 0 } }
lleadbet commented 3 years ago

Thanks, and apologies for the delay in responses.

Are you still seeing this, and if so, what webhook are you using- Eventsub or Webhooks?

aeturnum commented 3 years ago

No problem @lleadbet, this is an odd bug and I'm sure y'all have more important ones.

I am using webhooks to get notified of streams - I don't think I've seen eventsub in the docs. Is that better maintained?

In any case, I just repeated starting my usual stream of the Microsoft™️ Edge™️ home screen. Once again, the Helix API shows nothing and the Kraken API shows the stream. However, this time I never got a notification even though I believe I have an active webhook subscription for my channel.

To be honest I have no idea how consistent this bug is - it always works when I'm testing, but I'm more of a developer than a streamer so I don't notice unless I'm working on some new feature.

Logs from just now ``` ddrexler@Drexbook-Pro:syslogreader| git:(master) 4M$ http -v 'https://api.twitch.tv/helix/streams?user_id=503254' Client-Id:****************************** Authorization:"Bearer ******************************" GET /helix/streams?user_id=503254 HTTP/1.1 Accept: */* Accept-Encoding: gzip, deflate Authorization: Bearer ****************************** Client-Id: ****************************** Connection: keep-alive Host: api.twitch.tv User-Agent: HTTPie/2.3.0 HTTP/1.1 200 OK Access-Control-Allow-Origin: * Cache-Control: no-cache, no-store, must-revalidate, private Connection: keep-alive Content-Length: 27 Content-Type: application/json; charset=utf-8 Date: Thu, 21 Jan 2021 18:41:58 GMT Expires: 0 Pragma: no-cache Ratelimit-Limit: 800 Ratelimit-Remaining: 799 Ratelimit-Reset: 1611254519 Strict-Transport-Security: max-age=300 Timing-Allow-Origin: https://www.twitch.tv Twitch-Trace-Id: d4b0d7cd9e8b242167ffd00de796682d Vary: Accept-Encoding X-Cache: MISS, MISS X-Cache-Hits: 0, 0 X-Ctxlog-Logid: 1-6009caf6-590d75df45181e4104d4aaa2 X-Served-By: cache-sea4471-SEA, cache-lax10677-LGB X-Timer: S1611254518.292967,VS0,VS0,VE57 { "data": [], "pagination": {} } cept:application/vnd.twitchtv.v5+jsonit:(master) 4M$ http -v 'https://api.twitch.tv/kraken/streams/503254?stream_type=live' Client-Id:****************************** Authorization:"Bearer ******************************" Ac -bash: ™http: command not found ddrexler@Drexbook-Pro:syslogreader| git:(master) 4M$ http -v 'https://api.twitch.tv/kraken/streams/503254?stream_type=live' Client-Id:****************************** Authorization:"Bearer ******************************" Accept:application/vnd.twitchtv.v5+json GET /kraken/streams/503254?stream_type=live HTTP/1.1 Accept: application/vnd.twitchtv.v5+json Accept-Encoding: gzip, deflate Authorization: Bearer ****************************** Client-Id: ****************************** Connection: keep-alive Host: api.twitch.tv User-Agent: HTTPie/2.3.0 HTTP/1.1 200 OK Access-Control-Allow-Origin: * Cache-Control: no-cache, no-store, must-revalidate, private Connection: keep-alive Content-Length: 1287 Content-Type: application/json; charset=utf-8 Date: Thu, 21 Jan 2021 18:44:40 GMT Expires: 0 Pragma: no-cache Strict-Transport-Security: max-age=300 Timing-Allow-Origin: https://www.twitch.tv Vary: Accept-Encoding X-Cache: MISS, MISS X-Cache-Hits: 0, 0 X-Served-By: cache-sea4458-SEA, cache-bur17522-BUR X-Timer: S1611254680.082200,VS0,VS0,VE56 { "stream": { "_id": 41401541998, "average_fps": 30, "broadcast_platform": "live", "channel": { "_id": 503254, "broadcaster_language": "en", "broadcaster_software": "", "broadcaster_type": "", "created_at": "2008-04-28T10:16:22.519482Z", "description": "Watch me be bad", "display_name": "aeturnum", "followers": 11, "game": "World of Warcraft", "language": "en", "logo": "https://static-cdn.jtvnw.net/jtv_user_pictures/aeturnum-profile_image-e52423744803803f-300x300.jpeg", "mature": false, "name": "aeturnum", "partner": false, "privacy_options_enabled": false, "private_video": false, "profile_banner": null, "profile_banner_background_color": "", "status": "Wow TBC Atlantiss", "updated_at": "2021-01-01T20:16:10.044745Z", "url": "https://www.twitch.tv/aeturnum", "video_banner": null, "views": 439 }, "community_id": "", "community_ids": [], "created_at": "2021-01-21T18:39:14Z", "delay": 0, "game": "World of Warcraft", "is_playlist": false, "preview": { "large": "https://static-cdn.jtvnw.net/previews-ttv/live_user_aeturnum-640x360.jpg", "medium": "https://static-cdn.jtvnw.net/previews-ttv/live_user_aeturnum-320x180.jpg", "small": "https://static-cdn.jtvnw.net/previews-ttv/live_user_aeturnum-80x45.jpg", "template": "https://static-cdn.jtvnw.net/previews-ttv/live_user_aeturnum-{width}x{height}.jpg" }, "stream_type": "live", "video_height": 1080, "viewers": 0 } } ```
aeturnum commented 2 years ago

Hi there! Just coming back to remind y'all that I can reproduce this 100% of the time: twitch_broken