Request hangs on API request

I’m writing a program that uses three different API endpoints from twtich:

  • https://api.twitch.tv/kraken/oauth2/authorize

  • https://api.twitch.tv/kraken

  • https://api.twitch.tv/helix/users

The first two always work fine, but the third endpoint sometimes causes my program to sometimes hang. It’s inconsistent, with the request working just fine some of the time.
I have no idea what could be causing this, and whether it’s on Twitch’s side or mine.
This is the code for the third request:

const reply = await request({
  uri: `https://api.twitch.tv/helix/users?login=${username}`,
  headers: { 'Client-ID': CLIENT_ID },
  json: true
});

I’ve tested some more and found that, once left for a while, the request fails with a socket hangup.

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