You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Context:
Library version 2.30
Transport method: websocket
Description:
The helixClient.CreateEventSubSubscription does not work anymore. It used to work fine last week (early September 2024).
Error message: Failed to execute API request: Post "https://api.twitch.tv/helix/eventsub/subscriptions": stream error: stream ID 'N'; INTERNAL_ERROR; received from peer
Code snippet:
funcregisterEvents(ws*WSConn, events*struct {
Client*helix.ClientRaw []*helix.EventSubSubscription
}) error {
// register eventsfor_, v:=rangeevents.Raw {
v.Transport.SessionID=ws.sessionIDresp, err:=events.Client.CreateEventSubSubscription(v)
iferr!=nil {
ws.Log.Println("Failed to subscribe to "+v.Type, err)
ifraw, ok:= (*rawByChannel).Load(ws.channel); ok {
raw.Close() // This closes my websocket connection in my internal package
}
returnerrors.New("eventsub: failed to sub "+v.Type)
}
ws.Log.Println("SUCCESS welcome register eventsub "+v.Type, resp.StatusCode)
}
returnnil
}
Workaround:
funcregisterEvents(ws*WSConn, events*struct {
Client*helix.ClientRaw []*helix.EventSubSubscription
}) error {
httpClient:= http.Client{}
// register eventsfor_, v:=rangeevents.Raw {
v.Transport.SessionID=ws.sessionIDevents.Client.GetUsers(&helix.UsersParams{}) // TODO: remove this, only used to refresh tokenrawSubBody, _:=json.Marshal(v)
// This function below suddenly doesn't work, which is why the manual http call is made// resp, err := events.Client.CreateEventSubSubscription(v)req, _:=http.NewRequest(http.MethodPost, "https://api.twitch.tv/helix/eventsub/subscriptions", bytes.NewBuffer(rawSubBody))
req.Header.Set("Client-Id", data.AppCfg.TwitchAPIClientID)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+events.Client.GetUserAccessToken())
resp, err:=httpClient.Do(req)
iferr!=nil||resp.StatusCode!=http.StatusAccepted {
ws.Log.Println("Failed to subscribe to "+v.Type, err)
ifraw, ok:= (*rawByChannel).Load(ws.channel); ok {
raw.Close()
}
returnerrors.New("eventsub: failed to sub "+v.Type)
}
ws.Log.Println("SUCCESS welcome register eventsub "+v.Type, resp.StatusCode)
}
returnnil
}
Full output from my app with error:
EVENTSUB_channelname 2024/09/14 17:04:01 Connecting to wss://eventsub.wss.twitch.tv/ws
EVENTSUB_channelname 2024/09/14 17:04:01 Failed to subscribe to channel.channel_points_custom_reward_redemption.add Failed to execute API request: Post "https://api.twitch.tv/helix/eventsub/subscriptions": stream error: stream ID 7; INTERNAL_ERROR; received from peer
2024/09/14 17:04:01 Log to file error when reading eventsub websocket
read tcp 10.0.0.132:47688-><redacted_public_twitch_ip>:443: use of closed network connection
goroutine 36 [running]:
runtime/debug.Stack()
/home/ubuntu/sdk/go1.23.1/src/runtime/debug/stack.go:26 +0x64
github.com/johnnylin-a/twitch-bot/pkg/eventsub.RunWS(0x54ee88, 0x40001bc160, {0x4000182f48, 0x8})
/mnt/vol1/ubuntu/code/twitch-bot/pkg/eventsub/eventsub.go:78 +0x3bc
main.main.gowrap1.main.func1.1({0x4000034180?, 0x847a4?}, {0x4000182f48, 0x8})
/mnt/vol1/ubuntu/code/twitch-bot/cmd/botws/main.go:69 +0xf0
main.main.func1(...)
/mnt/vol1/ubuntu/code/twitch-bot/cmd/botws/main.go:70
created by main.main in goroutine 1
/mnt/vol1/ubuntu/code/twitch-bot/cmd/botws/main.go:51 +0x470
EVENTSUB_channelname 2024/09/14 17:04:01 Closing raw socket due to error
Context:
Library version
2.30
Transport method:
websocket
Description:
The
helixClient.CreateEventSubSubscription
does not work anymore. It used to work fine last week (early September 2024).Error message:
Failed to execute API request: Post "https://api.twitch.tv/helix/eventsub/subscriptions": stream error: stream ID 'N'; INTERNAL_ERROR; received from peer
Code snippet:
Workaround:
Full output from my app with error:
Full output from my app with workaround:
The text was updated successfully, but these errors were encountered: