stg-annon / stashapi

api wrapper
MIT License
16 stars 8 forks source link

Crashes loading galleries #15

Closed yoshnopa closed 2 months ago

yoshnopa commented 2 months ago

Using the latest develop (commit bcf0fda7acdfa19117ef267f4c7789b896c3ccf4) of stash and also getting your latest code first by pypi and then by hand (adding the changes from commit 829ade253282b8e130057cf83750144c1e729816), I was not able to make my plugin work that tries to interact with galleries. While this is a self-written plugin, I am 99% sure that the retrieval from the backend with your library is currently not able to handle the requests. Full Error follows, just as a quick shortcut, it seems to be triggered by the line:

stash.find_gallery(id)

which seems innocent enough I think. However, this is the full error:

24-08-30 14:44:08
Error   
Gallery.Update.Post [Comic Info Extractor]: returned error: exit status 1
2024-08-30 14:44:08
Error   
[Plugin / Comic Info Extractor] Exception: 422 Unprocessable Entity query failed. v0.5.0-1736-g0370aec9
2024-08-30 14:44:08
Error   
[Plugin / Comic Info Extractor]     raise Exception(error_msg)
2024-08-30 14:44:08
Error   
[Plugin / Comic Info Extractor]   File "/usr/local/lib/python3.11/dist-packages/stashapi/classes.py", line 270, in _handle_GQL_response
2024-08-30 14:44:08
Error   
[Plugin / Comic Info Extractor]            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-08-30 14:44:08
Error   
[Plugin / Comic Info Extractor]     return self._handle_GQL_response(response)
2024-08-30 14:44:08
Error   
[Plugin / Comic Info Extractor]   File "/usr/local/lib/python3.11/dist-packages/stashapi/classes.py", line 227, in _GQL
2024-08-30 14:44:08
Error   
[Plugin / Comic Info Extractor]            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-08-30 14:44:08
Error   
[Plugin / Comic Info Extractor]     return self._GQL(query, variables)
2024-08-30 14:44:08
Error   
[Plugin / Comic Info Extractor]   File "/usr/local/lib/python3.11/dist-packages/stashapi/stashapp.py", line 219, in call_GQL
2024-08-30 14:44:08
Error   
[Plugin / Comic Info Extractor]              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-08-30 14:44:08
Error   
[Plugin / Comic Info Extractor]     result = self.call_GQL(query, {"id":item_id})
2024-08-30 14:44:08
Error   
[Plugin / Comic Info Extractor]   File "/usr/local/lib/python3.11/dist-packages/stashapi/stashapp.py", line 112, in __generic_find
2024-08-30 14:44:08
Error   
[Plugin / Comic Info Extractor]            ^^^^^^^^^^^^^^^^^^^^
2024-08-30 14:44:08
Error   
[Plugin / Comic Info Extractor]     return self.__generic_find(
2024-08-30 14:44:08
Error   
[Plugin / Comic Info Extractor]   File "/usr/local/lib/python3.11/dist-packages/stashapi/stashapp.py", line 1226, in find_gallery
2024-08-30 14:44:08
Error   
[Plugin / Comic Info Extractor]             ^^^^^^^^^^^^^^^^^^^^^^
2024-08-30 14:44:08
Error   
[Plugin / Comic Info Extractor]     gallery=stash.find_gallery(id)
2024-08-30 14:44:08
Error   
[Plugin / Comic Info Extractor]   File "/var/www/.stash/plugins/comicInfoExtractor/comicInfoExtractor.py", line 123, in <module>
2024-08-30 14:44:08
Error   
[Plugin / Comic Info Extractor] Traceback (most recent call last):
2024-08-30 14:44:08
Error   
[Plugin / Comic Info Extractor] 422 Unprocessable Entity query failed. v0.5.0-1736-g0370aec9
2024-08-30 14:44:08
Error   
[Plugin / Comic Info Extractor] 422 Unprocessable Entity GQL data response is null
2024-08-30 14:44:08
Error   
[Plugin / Comic Info Extractor] GRAPHQL_VALIDATION_FAILED: Field "image" argument "index" of type "Int!" is required, but it was not provided.
2024-08-30 14:44:08
Error   
[Plugin / Comic Info Extractor] GRAPHQL_VALIDATION_FAILED: Field "image" argument "index" of type "Int!" is required, but it was not provided.

Thank you for your time and patience providing this library!

stg-annon commented 2 months ago

its a GQL error so Stash is not happy with something in the request, I'm not currently on latest dev but I am on a dev build that I just checked against and it seems to still be working I'll need to update to see if something changed with galleries

yoshnopa commented 2 months ago

I think it is due to the gallery scrubber, (996dfb1c2f85481a66929e700e1931991b51a6e4 or MR 5133). There was a change that sets the field image as part of the graphql definition (graphql/schema/types/gallery.graphql)

stg-annon commented 2 months ago

try defining a custom fragment for it

stg-annon commented 2 months ago

@yoshnopa try with v0.2.52

yoshnopa commented 2 months ago

Perfect, that fixes it! However, a new error comes up (although its the last one, when I hardcoded it out it ran smoothly. It also handles tags, and chapterdata, so after this it should be largely covered). This time coming from find_studio:

galleryData[data]=studioName
stash.find_studio(galleryData[data], create=True)
024-08-31 10:37:47
Error   
Gallery.Update.Post [Comic Info Extractor]: returned error: exit status 1
2024-08-31 10:37:47
Error   
[Plugin / Comic Info Extractor]     raise Exception(error_msg)
2024-08-31 10:37:47
Error   
[Plugin / Comic Info Extractor] Exception: 422 Unprocessable Entity query failed. v0.5.0-1736-g0370aec9
2024-08-31 10:37:47
Error   
[Plugin / Comic Info Extractor]            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-08-31 10:37:47
Error   
[Plugin / Comic Info Extractor]   File "/usr/local/lib/python3.11/dist-packages/stashapi/classes.py", line 270, in _handle_GQL_response
2024-08-31 10:37:47
Error   
[Plugin / Comic Info Extractor]     return self._handle_GQL_response(response)
2024-08-31 10:37:47
Error   
[Plugin / Comic Info Extractor]            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-08-31 10:37:47
Error   
[Plugin / Comic Info Extractor]   File "/usr/local/lib/python3.11/dist-packages/stashapi/classes.py", line 227, in _GQL
2024-08-31 10:37:47
Error   
[Plugin / Comic Info Extractor]     return self._GQL(query, variables)
2024-08-31 10:37:47
Error   
[Plugin / Comic Info Extractor]   File "/usr/local/lib/python3.11/dist-packages/stashapi/stashapp.py", line 221, in call_GQL
2024-08-31 10:37:47
Error   
[Plugin / Comic Info Extractor]              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-08-31 10:37:47
Error   
[Plugin / Comic Info Extractor]     result = self.call_GQL(query, {"id":item_id})
2024-08-31 10:37:47
Error   
[Plugin / Comic Info Extractor]            ^^^^^^^^^^^^^^^^^^^^
2024-08-31 10:37:47
Error   
[Plugin / Comic Info Extractor]   File "/usr/local/lib/python3.11/dist-packages/stashapi/stashapp.py", line 114, in __generic_find
2024-08-31 10:37:47
Error   
[Plugin / Comic Info Extractor]     return self.__generic_find(
2024-08-31 10:37:47
Error   
[Plugin / Comic Info Extractor]   File "/usr/local/lib/python3.11/dist-packages/stashapi/stashapp.py", line 1023, in find_studio
2024-08-31 10:37:47
Error   
[Plugin / Comic Info Extractor]            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-08-31 10:37:47
Error   
[Plugin / Comic Info Extractor]     return self.find_studio(studio_matches[0]["id"], fragment=fragment)
2024-08-31 10:37:47
Error   
[Plugin / Comic Info Extractor]   File "/usr/local/lib/python3.11/dist-packages/stashapi/stashapp.py", line 1049, in find_studio
2024-08-31 10:37:47
Error   
[Plugin / Comic Info Extractor]                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-08-31 10:37:47
Error   
[Plugin / Comic Info Extractor]     galleryData[data] = stash.find_studio(galleryData[data], create=True)["id"]
2024-08-31 10:37:47
Error   
[Plugin / Comic Info Extractor]   File "/var/www/.stash/plugins/comicInfoExtractor/comicInfoExtractor.py", line 68, in processGallery
stg-annon commented 2 months ago

was likely an issue with the fragment override for Groups v0.2.53 should have fixed this

yoshnopa commented 2 months ago

That did the trick! Thanks again for your quick action! I will close the ticket.