graphql-platform: Error Reading JObject from JsonReader

Describe the bug Just trying to get the bare minimum example of hotchocolate.io stuff running, fired up a new project with the starwars template. I then pointed graphiql at it, and it seems like somewhere things go south in trying to get the metadata for the schema.

I’m unsure this is specifically a problem with starwars sample specifically, but also might be a misunderstanding on how graphiql tool works. I tried several queries, but seems like its trying to do its introspection query before anything else anyway.

In analyzing what graphiql is sending to the starwars app, its get request to http://localhost:port/?query=

    query IntrospectionQuery {
      __schema {
        queryType { name }
        mutationType { name }
        subscriptionType { name }
        types {
          ...FullType
        }
        directives {
          name
          description
          locations
          args {
            ...InputValue
          }
        }
      }
    }

    fragment FullType on __Type {
      kind
      name
      description
      fields(includeDeprecated: true) {
        name
        description
        args {
          ...InputValue
        }
        type {
          ...TypeRef
        }
        isDeprecated
        deprecationReason
      }
      inputFields {
        ...InputValue
      }
      interfaces {
        ...TypeRef
      }
      enumValues(includeDeprecated: true) {
        name
        description
        isDeprecated
        deprecationReason
      }
      possibleTypes {
        ...TypeRef
      }
    }

    fragment InputValue on __InputValue {
      name
      description
      type { ...TypeRef }
      defaultValue
    }

    fragment TypeRef on __Type {
      kind
      name
      ofType {
        kind
        name
        ofType {
          kind
          name
          ofType {
            kind
            name
            ofType {
              kind
              name
              ofType {
                kind
                name
                ofType {
                  kind
                  name
                  ofType {
                    kind
                    name
                  }
                }
              }
            }
          }
        }
      }
    }
  &variables="{}"

To Reproduce Steps to reproduce the behavior:

  1. Initialize new starwars example
  2. Run graphiql with the endpoint set to the hostname and port, dotnet run is using
  3. Attempt to run anything in the user interface
  4. Observe failure, and failure in the console
fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
      An unhandled exception has occurred while executing the request.
Newtonsoft.Json.JsonReaderException: Error reading JObject from JsonReader. Current JsonReader item is not an object: String. Path '', line 1, position 4.
   at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings)
   at Newtonsoft.Json.Linq.JObject.Parse(String json, JsonLoadSettings settings)
   at HotChocolate.AspNetCore.GetRequest.ReadRequest(HttpContext context)
   at HotChocolate.AspNetCore.QueryMiddleware.HandleRequestAsync(HttpContext context, QueryExecuter queryExecuter, CancellationToken cancellationToken)
   at HotChocolate.AspNetCore.QueryMiddleware.Invoke(HttpContext context, QueryExecuter queryExecuter)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

Expected behavior Probably return schema information provided by starwars example

Additional context I additionally tried updating to the very latest version of hotchocolate.io, and found that it was reporting the same errors.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 17 (12 by maintainers)

Most upvoted comments

Was able to query and was able to get what I would expect after playing with it a bit more.