"Streams" Webhook sending incorrect offline payload

I’ve been using webhooks for several months without a problem, but in the past one month or so, I’ve been receiving erroneous offline payloads almost immediately after receiving a valid stream payload, followed by another valid stream payload.

Here is one example from my logs:

[2020-10-02 17:53:09] [17] [INFO] [Webhook] LIVE HasanAbi "Just Chatting"

Headers:

Link: <https://api.twitch.tv/helix/webhooks/hub>; rel="hub", <https://api.twitch.tv/helix/streams?user_id=207813352>; rel="self"
Twitch-Notification-Id: 77f6073a-7cff-4f52-a14b-2a5b5b67cea7
Twitch-Notification-Retry: 0
Twitch-Notification-Timestamp: 2020-10-02T17:53:09Z

Body:
{
    "data": [{
        "game_id": "509658",
        "id": "39934444398",
        "language": "en",
        "started_at": "2020-10-02T17:52:27Z",
        "tag_ids": null,
        "thumbnail_url": "https://static-cdn.jtvnw.net/previews-ttv/live_user_hasanabi-{width}x{height}.jpg",
        "title": "TRUMP HAS COVID LMAOOOOOOOOOOOOOOO ",
        "type": "live",
        "user_id": "207813352",
        "user_name": "HasanAbi",
        "viewer_count": 0
    }]
}

---------------------------------------------------------------

[2020-10-02 17:53:36] [19] [INFO] [Webhook] AWAY HasanAbi

Headers:

Link: <https://api.twitch.tv/helix/webhooks/hub>; rel="hub", <https://api.twitch.tv/helix/streams?user_id=207813352>; rel="self"
Twitch-Notification-Id: 7f9df43d-702b-4b1a-8efc-2d79197d780a
Twitch-Notification-Retry: 0
Twitch-Notification-Timestamp: 2020-10-02T17:53:36Z

Body:
{
    "data": []
}

---------------------------------------------------------------

[2020-10-02 17:54:05] [18] [INFO] [Webhook] LIVE HasanAbi "Just Chatting"

Headers:

Link: <https://api.twitch.tv/helix/webhooks/hub>; rel="hub", <https://api.twitch.tv/helix/streams?user_id=207813352>; rel="self"
Twitch-Notification-Id: 1fd18b76-9081-4e3f-80b5-5de9db3c0b5e
Twitch-Notification-Retry: 0
Twitch-Notification-Timestamp: 2020-10-02T17:54:05Z

Body:
{
    "data": [{
        "game_id": "509658",
        "id": "39934444398",
        "language": "en",
        "started_at": "2020-10-02T17:52:27Z",
        "tag_ids": null,
        "thumbnail_url": "https://static-cdn.jtvnw.net/previews-ttv/live_user_hasanabi-{width}x{height}.jpg",
        "title": "TRUMP HAS COVID LMAOOOOOOOOOOOOOOO ",
        "type": "live",
        "user_id": "207813352",
        "user_name": "HasanAbi",
        "viewer_count": 0
    }]
}

About 30 seconds after receiving the first payload (which, compared to the previous one received indicates that the streamer is now live), Twitch sends an offline payload, followed by a payload identical to the first (but with a different Twitch-Notification-Id) another 30 seconds later.

Additionally, fetching https://api.twitch.tv/helix/webhooks/subscriptions yields no duplicated or unexpected subscriptions.

Things I’m currently doing:

  • Recording Twitch-Notification-Id values and discarding duplicate notifications
  • Subscribing to topics with a unique path, e.g. /webhooks/stream_state/207813352
  • Responding to notifications in < 20ms

I’m not sure if I’m doing something wrong or if there is a bug with Twitch, as this happens for multiple streamers and not just HasanAbi.

This is a known issue, tracked here: https://github.com/twitchdev/issues/issues/230

Twitch are looking in to it.

Thanks, glad that I’m not the only one :+1:

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