nozzlegear / ShopifySharp

ShopifySharp is a .NET library that helps developers easily authenticate with and manage Shopify stores.
https://nozzlegear.com/shopify-development-handbook
MIT License
747 stars 309 forks source link

Query demands required parameter after version update #1078

Open QnavWhat opened 3 months ago

QnavWhat commented 3 months ago

Hi, I just updated from Version 6.3.0 to 6.6.0 and without changing the queries, I get the following error message when running GraphQL calls:

{"(400 Bad Request) query: Required parameter missing or invalid"}

The same query runs fine with the previous version and I could find any change log with related information. The higher versions I tested return this message as well. I get the error message for every query I tested like ''query MyQuery { shop { name } }". When using e.g. POSTMAN I can run the query without exception.

Thanks and regards

nozzlegear commented 3 months ago

Hey @QnavWhat! Can you post the code you're using to send the query?

QnavWhat commented 3 months ago

Hi @nozzlegear this is a code snippet to reproduce

Public Shared Function GraphQL_Query() As String

    Dim ret As String = ""

    Try
        Dim loc = ShopifyHelper2024.serviceLocation.ListAsync().Result.Items.First
        Console.WriteLine(loc.Id)

        Dim body = "query { shop { id name } }"
        Dim res = ShopifyHelper2024.serviceGraphQL.PostAsync(body:=body).Result
        ret = res("shop")("name")
        Console.WriteLine(ret)

    Catch ex As Exception
        ret = ex.Message
    End Try

    Return ret

End Function

The first call to serviceLocation is returning the location ID, which I just added to verify a correct initialisation of ShopifyHelper2024. Running the exact code with Version 6.4.0 will return Shop-Name but with Version 6.6.0 it will return error 400.

QnavWhat commented 2 months ago

Is there anything I can try t to adapt in my API-call?

nozzlegear commented 2 months ago

Hey @QnavWhat! Sorry, this slipped my mind. I’m currently making my way back home on a road trip so I can’t dig into any code. Can you try upgrading to the latest version of ShopifySharp to see if that fixes the problem?

QnavWhat commented 2 months ago

I tried using Version 6.18.0 to see the output. However a different error appeared. So I ran through the Version to test where related changes happend:

6.4.0 --> fine with the code posted above 6.6.0-b118 --> {"(400 Bad Request) query: Required parameter missing or invalid"} 6.13.0-b182 --> {"Auf das verworfene Objekt kann nicht zugegriffen werden." & vbCrLf & "Objektname: ""System.Net.Http.StringContent""."} 6.18.0 --> still last error (which I guess relates to this issue https://github.com/nozzlegear/ShopifySharp/issues/1080)

QnavWhat commented 3 weeks ago

Hey @nozzlegear , ist my latest post somehow helpful?

nozzlegear commented 3 weeks ago

@QnavWhat it is helpful, yes! I'm sorry, I've been utterly swamped. I've set aside time to look at this and other ShopifySharp issues later this evening.

nozzlegear commented 3 weeks ago

Good news! I've found the issue, it's one of the overloads in the GraphService, which I have an open pull request for. I'm working on it right now, I'll publish it either tonight or tomorrow and will let you know when it's ready to test.

QnavWhat commented 3 weeks ago

Awesome, thanks a lot :) Will test that asap after your publish