TwitchDropsMiner icon indicating copy to clipboard operation
TwitchDropsMiner copied to clipboard

PersistedQueryNotFound GQL error

Open matarife123 opened this issue 1 year ago • 64 comments

Sin título

matarife123 avatar Feb 16 '23 19:02 matarife123

Same here

12:49:17: Fatal error encountered:
12:49:17: 
12:49:17: Traceback (most recent call last):
12:49:17:   File "main.py", line 175, in <module>
12:49:17:   File "asyncio\base_events.py", line 616, in run_until_complete
12:49:17:   File "twitch.py", line 759, in run
12:49:17:   File "twitch.py", line 801, in _run
12:49:17:   File "twitch.py", line 1594, in fetch_inventory
12:49:17:   File "twitch.py", line 1534, in gql_request
12:49:17: exceptions.MinerException: GQL error: [{'message': 'PersistedQueryNotFound'}]
12:49:17: 
12:49:17: Exiting...
12:49:18: 
12:49:18: Application Terminated.
12:49:18: Close the window to exit the application.

allanf181 avatar Feb 17 '23 15:02 allanf181

same here.

notNSANE avatar Feb 17 '23 15:02 notNSANE

got the same problem image

DuoZock avatar Feb 17 '23 18:02 DuoZock

Same. I think twitch might have found a way to block the app. Could need an update

xeddmc avatar Feb 17 '23 21:02 xeddmc

Randomly random GQL requests fail or Twitch sends garbage. The tool needs to be much more error resilient and not crash on the faintest of error.

Tristar7 avatar Feb 17 '23 21:02 Tristar7

same here

MingY00 avatar Feb 18 '23 01:02 MingY00

Log with log level CALL

...
00:02:29: INFO: sure_ goes OFFLINE
00:02:30: CALL: Channel update from websocket: sure_
00:02:41: CALL: Drop update from websocket: Holy Flare (Halo Infinite, 59/60)
00:03:42: Earned points for watching:  10, total: 370
00:03:42: CALL: Drop update from websocket: Holy Flare (Halo Infinite, 60/60)
00:03:43: Claimed drop: Halo Infinite "Holy Flare" Charm (1/1)
00:03:43: Claimed bonus points: 50
00:03:43: Earned points for watching:  50, total: 420
00:03:53: CALL: Maintenance task waiting until: 00:33:53 (Points)
00:03:53: INFO: Websocket[7] stopped.
00:03:53: INFO: Websocket[6] stopped.
00:03:53: INFO: Websocket[5] stopped.
00:03:53: INFO: Websocket[4] stopped.
00:03:53: INFO: Websocket[3] stopped.
00:03:53: INFO: Websocket[2] stopped.
00:03:53: INFO: Websocket[1] stopped.
00:03:55: Fatal error encountered:
00:03:55: 
00:03:55: Traceback (most recent call last):
00:03:55:   File "main.py", line 175, in <module>
00:03:55:   File "asyncio\base_events.py", line 616, in run_until_complete
00:03:55:   File "twitch.py", line 759, in run
00:03:55:   File "twitch.py", line 908, in _run
00:03:55:   File "twitch.py", line 1677, in get_live_streams
00:03:55:   File "twitch.py", line 1534, in gql_request
00:03:55: exceptions.MinerException: GQL error: [{'message': 'PersistedQueryNotFound'}]
00:03:55: 
00:03:55: Exiting...
00:03:55: INFO: Websocket[0] stopped.
00:03:55: 
00:03:55: Application Terminated.
00:03:55: Close the window to exit the application.

allanf181 avatar Feb 18 '23 03:02 allanf181

Same problem

emaf94 avatar Feb 18 '23 07:02 emaf94

me too

Nana7mi12 avatar Feb 18 '23 10:02 Nana7mi12

Yup.

WrayOfSunshine avatar Feb 18 '23 12:02 WrayOfSunshine

Same problem after reinstall 13:51:56: Fatal error encountered: 13:51:56: 13:51:56: Traceback (most recent call last): 13:51:56: File "main.py", line 175, in <module> 13:51:56: File "asyncio\base_events.py", line 616, in run_until_complete 13:51:56: File "twitch.py", line 759, in run 13:51:56: File "twitch.py", line 908, in _run 13:51:56: File "twitch.py", line 1677, in get_live_streams 13:51:56: File "twitch.py", line 1534, in gql_request 13:51:56: exceptions.MinerException: GQL error: [{'message': 'PersistedQueryNotFound'}] 13:51:56: 13:51:56: Exiting... 13:51:56: 13:51:56: Application Terminated. 13:51:56: Close the window to exit the application.

kartax4 avatar Feb 18 '23 12:02 kartax4

Can reproduce

hifocus avatar Feb 18 '23 14:02 hifocus

same

lvg3618 avatar Feb 18 '23 16:02 lvg3618

Im facing the same problem here and temporarily fixing it by restarting the app after every claim

Jokerverse avatar Feb 18 '23 21:02 Jokerverse

Hi. Hmm, this just looks like the GQL queries the miner is using have became really old, so old that Twitch moved onto new ones in the mean time. This shouldn't be too hard to fix, assuming the new queries didn't remove crucial info I was using before.

DevilXD avatar Feb 19 '23 10:02 DevilXD

As I said, simply putting in new hashes worked: https://github.com/DevilXD/TwitchDropsMiner/commit/bfd389392127488a963fc696583fc140745494b8

This is already fixed in dev, but it's gonna take a while to make it to official release. In the mean time, one can rebuild the application on their side by following the building process: https://github.com/DevilXD/TwitchDropsMiner/wiki/Setting-up-the-environment,-building-and-running

DevilXD avatar Feb 19 '23 10:02 DevilXD

thanks you for all :D

matarife123 avatar Feb 19 '23 10:02 matarife123

Hi,

Thanks for the quick fix ! I just rebuild the project using new hashes, yet I face another error :

11:57:09: Fatal error encountered:
11:57:09: 
11:57:09: Traceback (most recent call last):
11:57:09:   File "E:\Documents\Documents\PythonScripts\TwitchDropMiner_main\main.py", line 175, in <module>
11:57:09:     loop.run_until_complete(client.run())
11:57:09:   File "C:\Users\adri8\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 650, in run_until_complete
11:57:09:     return future.result()
11:57:09:            ^^^^^^^^^^^^^^^
11:57:09:   File "E:\Documents\Documents\PythonScripts\TwitchDropMiner_main\twitch.py", line 759, in run
11:57:09:     await self._run()
11:57:09:   File "E:\Documents\Documents\PythonScripts\TwitchDropMiner_main\twitch.py", line 908, in _run
11:57:09:     new_channels.update(await self.get_live_streams(game))
11:57:09:                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11:57:09:   File "E:\Documents\Documents\PythonScripts\TwitchDropMiner_main\twitch.py", line 1687, in get_live_streams
11:57:09:     return [
11:57:09:            ^
11:57:09:   File "E:\Documents\Documents\PythonScripts\TwitchDropMiner_main\twitch.py", line 1688, in <listcomp>
11:57:09:     Channel.from_directory(self, stream_channel_data["node"])
11:57:09:   File "E:\Documents\Documents\PythonScripts\TwitchDropMiner_main\channel.py", line 114, in from_directory
11:57:09:     self._stream = Stream.from_directory(self, data)
11:57:09:                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11:57:09:   File "E:\Documents\Documents\PythonScripts\TwitchDropMiner_main\channel.py", line 64, in from_directory
11:57:09:     tags=data["tags"],
11:57:09:          ~~~~^^^^^^^^
11:57:09: KeyError: 'tags'
11:57:09: 
11:57:09: Exiting...
11:57:09: 
11:57:09: Application Terminated.
11:57:09: Close the window to exit the application.

I tried deleting the cookies.jar just in case, same issue..

I'm not sure if it should be a new issue, let me know !

aalbouy avatar Feb 19 '23 11:02 aalbouy

Yeah, I worried that might be an issue - it's the result of Twitch updating their queries. Now there are only "freeFormTags" available on that data object there, meaning the miner can't determine if there is a drops tag available or not. I'll try searching for a solution, but that'll take longer than a simple hashes update like this.

DevilXD avatar Feb 19 '23 13:02 DevilXD

I hacked a thing using the "freeFormTags" and some translation of "DropsEnabled" value that I found, but I guess that's up to the streamer to add these tags ? So it's not perfect...

aalbouy avatar Feb 19 '23 14:02 aalbouy

The point isn't extracting the tag, but more about the tag's meaning. It doesn't look like that tag means what you think it does anymore, and the actual information telling others whether or not the drops are enabled on a channel or not, isn't available anymore. Streamers add these because that's how it used to function before, that others are used to seeing, for increased views.

EDIT: https://www.reddit.com/r/Twitch/comments/wqlwbz/new_tags_system_and_drops_enabled_streams/

DevilXD avatar Feb 19 '23 14:02 DevilXD

This is far from ideal, but it works: https://github.com/DevilXD/TwitchDropsMiner/commit/793fb5ccaf579c99cf3cc75d816362060697b639

DevilXD avatar Feb 19 '23 15:02 DevilXD

Isn't it a good idea to generate the GQL hashes live inside the program so they can never expire?

Walter-o avatar Feb 19 '23 16:02 Walter-o

It's not that easy. Twitch does accept raw GQL queries with no hashes, but since none of the Twitch's official apps uses those, it'd be really easy to see someone doing custom queries on the system. One way I could think of is parsing the web client to extract hashes out of (since they're hardcoded there), but the GQL operations don't change that often (this is like the 2nd breaking change ever since this project started existing) so it was never smth to really worry about.

DevilXD avatar Feb 19 '23 21:02 DevilXD

22:46:32: Fatal error encountered: 22:46:32: 22:46:32: Traceback (most recent call last): 22:46:32: File "main.py", line 175, in 22:46:32: File "asyncio\base_events.py", line 616, in run_until_complete 22:46:32: File "twitch.py", line 759, in run 22:46:32: File "twitch.py", line 801, in _run 22:46:32: File "twitch.py", line 1594, in fetch_inventory 22:46:32: File "twitch.py", line 1534, in gql_request 22:46:32: exceptions.MinerException: GQL error: [{'message': 'PersistedQueryNotFound'}] 22:46:32: 22:46:32: 正在退出... 22:46:33: 22:46:33: 应用程序已终止,请关闭窗口以退出应用程序。

ZeorymerX avatar Feb 22 '23 14:02 ZeorymerX

I rebuilt the application from the latest dev files and it works fine, you can do this as a temporarily option till @DevilXD releases the official release. The tutorial is super easy just follow the steps https://github.com/DevilXD/TwitchDropsMiner/wiki/Setting-up-the-environment,-building-and-running

Jokerverse avatar Feb 22 '23 19:02 Jokerverse

19:37:16: Traceback (most recent call last):
19:37:16:   File "main.py", line 175, in <module>
19:37:16:   File "asyncio\base_events.py", line 642, in run_until_complete
19:37:16:   File "twitch.py", line 759, in run
19:37:16:   File "twitch.py", line 812, in _run
19:37:16:   File "inventory.py", line 202, in claim
19:37:16:   File "inventory.py", line 120, in claim
19:37:16:   File "inventory.py", line 136, in _claim
19:37:16:   File "twitch.py", line 1534, in gql_request
19:37:16: exceptions.MinerException: GQL error: [{'message': 'PersistedQueryNotFound'}]

Happened due to having an Unclaimed Item (from NMS). Self-compiled after your fixes.

skupfer avatar Feb 23 '23 18:02 skupfer

@skupfer This is from the latest master?

DevilXD avatar Feb 24 '23 08:02 DevilXD

@DevilXD Hi, I have the same problem in the new version even after replacing the files, but much less often with a 1/15 chance every drop change

EmiMathesi avatar Feb 24 '23 08:02 EmiMathesi

I may need to dig deeper into the cause of this. It could be that Twitch is actually juggling these together with raw queries now, meaning it sends the hashed version, and if it fails with this error, it sends the actual query. Ever since v15 release, I've had pretty much no available time to do much with this project, but I'll try once I can find some.

DevilXD avatar Feb 24 '23 12:02 DevilXD