twitchdev / issues

Issue tracker for third party developers.
Apache License 2.0
74 stars 6 forks source link

`/helix/channels` returns status code 500 #592

Closed bastimeyer closed 2 years ago

bastimeyer commented 2 years ago

Brief description

This API issue has started happening a couple of minutes ago.

Depending on the broadcaster_id(s) set on the query string of the /helix/channels endpoint, a 500 error code is returned.

I first thought that this was caused by the number of the broadcaster_id parameters, and it only returned a 500 code when more than 6 were requested, but it looks like the faulty responses depend on the IDs themselves (or a combination, whatever).

How to reproduce

curl 'https://api.twitch.tv/helix/channels?broadcaster_id=26301881&broadcaster_id=23161357&broadcaster_id=108268890&broadcaster_id=50160915&broadcaster_id=49440419&broadcaster_id=39176440&broadcaster_id=31239503' \
  -H 'authorization: Bearer YOUR_OAUTH_TOKEN' \
  -H 'client-id: YOUR_CLIENT_ID'
{"error":"Internal Server Error","status":500,"message":""}

Expected behavior

curl 'https://api.twitch.tv/helix/channels?broadcaster_id=31239503' \
  -H 'authorization: Bearer YOUR_OAUTH_TOKEN' \
  -H 'client-id: YOUR_CLIENT_ID'
{"data":[{"broadcaster_id":"31239503","broadcaster_login":"esl_csgo","broadcaster_name":"ESL_CSGO","broadcaster_language":"en","game_id":"32399","game_name":"Counter-Strike: Global Offensive","title":"RERUN: Outsiders vs. FaZe - Map 2 [Dust2] - ESL Pro League Season 15 - Group B","delay":0}]}
belliapptw commented 2 years ago

We have started investigating. Thank you for reporting this

bastimeyer commented 2 years ago

The response now has changed to this instead of error code 500, but only sometimes:

{"error":"Too Many Requests","status":429,"message":"too many requests"}

curl 'https://api.twitch.tv/helix/channels?broadcaster_id=26301881&broadcaster_id=23161357&broadcaster_id=108268890&broadcaster_id=50160915&broadcaster_id=49440419' \
      -H 'authorization: Bearer YOUR_OAUTH_TOKEN' \
      -H 'client-id: YOUR_CLIENT_ID'
{"data":[{"broadcaster_id":"26301881","broadcaster_login":"sodapoppin","broadcaster_name":"sodapoppin","broadcaster_language":"en","game_id":"517251","game_name":"Mini Healer","title":"Poopoo Monday | https://sodapoppin.shop/plushies","delay":0},{"broadcaster_id":"23161357","broadcaster_login":"lirik","broadcaster_name":"LIRIK","broadcaster_language":"en","game_id":"509658","game_name":"Just Chatting","title":"LOLLLLLLLLLLLLLLLL","delay":0},{"broadcaster_id":"108268890","broadcaster_login":"gorgc","broadcaster_name":"Gorgc","broadcaster_language":"en","game_id":"29595","game_name":"Dota 2","title":"BOTA","delay":0},{"broadcaster_id":"50160915","broadcaster_login":"dreamleague","broadcaster_name":"DreamLeague","broadcaster_language":"en","game_id":"29595","game_name":"Dota 2","title":"LIVE: Chicken Fighters vs CHILLAX - DPC WEU Tour 2 - DreamLeague Season 17","delay":0},{"broadcaster_id":"49440419","broadcaster_login":"qojqva","broadcaster_name":"qojqva","broadcaster_language":"en","game_id":"29595","game_name":"Dota 2","title":"🔴 HIGHEST AVERAGE MMR PUB GAMES (10k+) 🔴 PARTY WITH XQC🔴 !youtube 🔴 !discord","delay":0}]}

Same request a couple of seconds later:

curl 'https://api.twitch.tv/helix/channels?broadcaster_id=26301881&broadcaster_id=23161357&broadcaster_id=108268890&broadcaster_id=50160915&broadcaster_id=49440419' \
      -H 'authorization: Bearer YOUR_OAUTH_TOKEN' \
      -H 'client-id: YOUR_CLIENT_ID'
{"error":"Too Many Requests","status":429,"message":"too many requests"}
belliapptw commented 2 years ago

These calls were always being rate limited. It just was not reflected to the clients correctly. Our fix that rolled out this afternoon, now accurately reflects the error.

bastimeyer commented 2 years ago

I am not rate limited though

Status Code: 429 ratelimit-limit: 800 ratelimit-remaining: 798 ratelimit-reset: 1649720751

TyrenDe commented 2 years ago

I am not rate limited though

Status Code: 429 ratelimit-limit: 800 ratelimit-remaining: 798 ratelimit-reset: 1649720751

We are seeing the 429s now too, but our rate limits match what the author sees. That is, it shouldn't be getting rate limited as we have 798 remaining.

bastimeyer commented 2 years ago

And btw, requesting only a single broadcaster_id doesn't result in the 500 (now 429) errors.

bastimeyer commented 2 years ago

Seems to be working correctly and reliably again.