gazuntype/graphQL-client-unity

Initial Introspection Fails: JsonReaderException

Opened this issue · 0 comments

Context / What I Was Trying To Do:

I've been playing around with the Enjin Unity SDK (https://github.com/twglhk/Enjin-Unity-sample). The Enjin ecosystem uses GraphQL and, as you would expect, the Unity SDK is in large part centered around sending queries via web request to their graphql endpoints.

However, the SDK is kind of a mess. They are building a lot of their queries / injecting variables via string manipulation which is error prone and a security vulnerability. Given that, I have been exploring other, hopefully better options / tools for creating, serializing, sending, GraphQL queries (and receiving responses). This client looks awesome / like just what I need in many ways!

Unfortunately, I haven't been able to get it working yet!

The issue here / how to reproduce:

  1. I imported your plugin
  2. Created a new API Reference scriptable object (Named "Enjin API Reference)
  3. Added the URL to the endpoint (in this case, I am building out on the Kovan test network, the URL is "https://kovan.cloud.enjin.io/")
  4. Pressed "Introspect"
  5. The below errors / logs popped up and the scriptable object continues to say "API is being introspected, please wait..."

Any help would be greatly appreciated! Happy to provide more info if I missed something too!

Thanks for all of your hard work!
-Drake

Log That Gets Written Before the Unhandled Exception:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="robots" content="noindex,nofollow,noarchive" />
<title>An Error Occurred: Method Not Allowed</title>
<style>body { background-color: #fff; color: #222; font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; margin: 0; }
.container { margin: 30px; max-width: 600px; }
h1 { color: #dc3545; font-size: 24px; }
h2 { font-size: 18px; }</style>
</head>
<body>
<div class="container">
<h1>Oops! An Error Occurred</h1>
<h2>The server returned a "405 Method Not Allowed".</h2>
<p>
Something is broken. Please let us know what you were doing when this error occurred.
We will fix it as soon as possible. Sorry for any inconvenience caused.
</p>
</div>
<script defer src="https://static.cloudflareinsights.com/beacon.min.js" data-cf-beacon='{"rayId":"6af15ca98d5319fb","token":"90b9898d975549fc99f35b663f8cf1e4","version":"2021.11.0","si":100}' crossorigin="anonymous"></script>
</body>
</html>
UnityEngine.Debug:Log (object)
GraphQlClient.Core.HttpHandler/<PostAsync>d__0:MoveNext () (at Assets/Plugins/graphQl-client/Scripts/Core/HttpHandler.cs:36)
System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:Run ()
GraphQlClient.Core.UnityWebRequestAwaiter:OnRequestCompleted (UnityEngine.AsyncOperation) (at Assets/Plugins/graphQl-client/Scripts/Extensions/UnityWebRequestExtensions.cs:30)
UnityEngine.AsyncOperation:InvokeCompletionEvent ()

Unhandled Exception:

JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
Newtonsoft.Json.JsonTextReader.ParseValue () (at <bc3985d37b0241b48fc21474b2de25bd>:0)
Newtonsoft.Json.JsonTextReader.Read () (at <bc3985d37b0241b48fc21474b2de25bd>:0)
Newtonsoft.Json.JsonReader.ReadAndMoveToContent () (at <bc3985d37b0241b48fc21474b2de25bd>:0)
Newtonsoft.Json.JsonReader.ReadForType (Newtonsoft.Json.Serialization.JsonContract contract, System.Boolean hasConverter) (at <bc3985d37b0241b48fc21474b2de25bd>:0)
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Boolean checkAdditionalContent) (at <bc3985d37b0241b48fc21474b2de25bd>:0)
Newtonsoft.Json.JsonSerializer.DeserializeInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType) (at <bc3985d37b0241b48fc21474b2de25bd>:0)
Newtonsoft.Json.JsonSerializer.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType) (at <bc3985d37b0241b48fc21474b2de25bd>:0)
Newtonsoft.Json.JsonConvert.DeserializeObject (System.String value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings) (at <bc3985d37b0241b48fc21474b2de25bd>:0)
Newtonsoft.Json.JsonConvert.DeserializeObject[T] (System.String value, Newtonsoft.Json.JsonSerializerSettings settings) (at <bc3985d37b0241b48fc21474b2de25bd>:0)
Newtonsoft.Json.JsonConvert.DeserializeObject[T] (System.String value) (at <bc3985d37b0241b48fc21474b2de25bd>:0)
GraphQlClient.Core.GraphApi.HandleIntrospection () (at Assets/Plugins/graphQl-client/Scripts/Core/GraphApi.cs:137)
UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at <2cd7ebc9c2ef4276a8edbc7de85c89ce>:0)