# Request hangs on API request

**URL:** <https://discuss.dev.twitch.com/t/request-hangs-on-api-request/13708>\
**Category:** API\
**Created:** [January 14, 2018, 5:35pm UTC](https://discuss.dev.twitch.com/t/request-hangs-on-api-request/13708 "2018-01-14T17:35:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![NatKarmios](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/natkarmios/32/3962_2.png) [@NatKarmios](https://discuss.dev.twitch.com/u/NatKarmios)\
**Post date:** [January 14, 2018, 5:35pm UTC](https://discuss.dev.twitch.com/t/request-hangs-on-api-request/13708/1 "2018-01-14T17:35:23Z")

</div>

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:

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

```

---

<div class="post-metadata">

**Author:** ![NatKarmios](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/natkarmios/32/3962_2.png) [@NatKarmios](https://discuss.dev.twitch.com/u/NatKarmios)\
**Post date:** [January 14, 2018, 5:49pm UTC](https://discuss.dev.twitch.com/t/request-hangs-on-api-request/13708/2 "2018-01-14T17:49:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://d2opxh93rbxzdn.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://discuss.dev.twitch.com/u/system)\
**Post date:** [February 13, 2018, 5:49pm UTC](https://discuss.dev.twitch.com/t/request-hangs-on-api-request/13708/3 "2018-02-13T17:49:44Z")

</div>

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