Fix followed games: send the query document instead of a rotating persisted hash - #142
Open
einanderson wants to merge 1 commit into
Open
Conversation
_get_followed() used a hardcoded persisted-query sha256 hash. Twitch rotates those hashes, and this one is no longer known, so the call only ever answers with PersistedQueryNotFound and "followed games" comes up empty. Send the full query document instead. The batched request and response shape stay the same, and so do the returned fields (id, name, displayName, boxArtURL, viewersCount), so callers need no change. Verified against gql.twitch.tv with a user token: the persisted variant returns PERSISTED_QUERY_NOT_FOUND, the query document returns the nodes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
"Following - Games" is empty: the route raises
NotFoundbecause Twitch answers the request withPersistedQueryNotFound.Cause
helix/games.py::_get_followedsends a persisted query with a hard-codedsha256Hash(
8446d4d2…). Twitch rotates those hashes, so the stored one eventually stops resolving andthe endpoint returns nothing usable.
The change
Send the full query document instead of the persisted hash:
The batch form (a list) is kept, so the response shape is identical
(
[0].data.currentUser.followedGames.nodes) and nothing changes on the add-on side —routes/followed.pyand the converter are untouched.Verification
Reproduced directly against
gql.twitch.tv(persisted hash →PersistedQueryNotFound, fulldocument → the nodes), and confirmed in Kodi 21.3 on two boxes: the folder lists the followed
games again.
Note: the query still filters on
type: LIVE, unchanged from before. A test without the filterreturned the same set here, so it is not the cause of an empty folder.
The follow/unfollow mutations in the same file still use persisted hashes. They are a different
matter — Twitch answers those with
IntegrityCheckFailedfor third-party clients regardless ofthe hash, so replacing it there would not help.