-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected, intermittent (!) deserialization error #139
Comments
So the check to ensure that the slice is not empty. If not the library will panic at this line. copied, err := copyTemplate(v.Index(0)) But you're right, |
@hgiasac ok, that makes sense, and it clarifies that my problem is probably due to something else. Thanks. Do you have any idea why I would be getting this failure intermittently? Could it be because I'm re-using the |
We may need the graphql schema on the server to know. I reproduced your use case and didn't see anything wrong with the response example that you sent. However, can you try this commit to see if it works #141 |
I'm seeing an intermittent failure right now where sometimes (inconsistently!) a Github Graphql API response fails to decode, resulting in an error like this:
This error is thrown in the deserialization code when
someSliceExist == false
. I'm curious if it's related to the changes in #102 — a PR that has no description, no tests, and changes something suspicious. If you look at that PR, it makes a change so that when there is a slice, but it's of zero length,someSliceExist == false
, whereas before this change,someSliceExist
would be set totrue
. I'm trying to understand why I'm seeing this error intermittently, which is always a red flag that something is horribly wrong, especially considering that the API response is valid JSON and seems to match what I am deserializing into (because it succeeds intermittently!)An example of the failure happening is when the API responds with:
and I'm trying to deserialize into a struct like this:
The actual call to
graphql
looks like this:Any ideas what's going on? I've worked around it for now by literally using the exact same query and struct, but using
ExecRaw
and decoding the JSON response myself. Doing this succeeds every time.Finally, I'll add that I was unable to reproduce the issue ever in a testcase calling into
jsonutil.UnmarshalGraphQL
. Here's my testcase that always passes (which is weird, because I'd expect this to fail):The text was updated successfully, but these errors were encountered: