Uploaded image for project: 'Magnolia GraphQL'
  1. Magnolia GraphQL
  2. MGNLGQL-72

Exception when query variables are null, like with GraphiQL

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 1.0
    • None
    • None

    Description

      Steps to reproduce

      1.  With "beta-2" - Use GraphiQL(attached as file) to submit a simple query with no varialbes, like:

       

      {
          books {
              title
          }
      }
      

       

      Expected results

      The response.

      Actual results

      {
        "status": 500,
        "errors": [
          "An internal server occurred, please check the log file"
        ]
      }
      

      Magnola log shows:

      graphql.AssertException: variables map can't be null
      	at graphql.Assert.assertNotNull(Assert.java:15) ~[graphql-java-14.1.jar:?]
      	at graphql.ExecutionInput$Builder.variables(ExecutionInput.java:243) ~[graphql-java-14.1.jar:?]
      	at info.magnolia.graphql.core.http.GraphQLServlet.handleQuery(GraphQLServlet.java:95) ~[magnolia-graphql-core-1.0-beta2.jar:?]
      	at info.magnolia.graphql.core.http.GraphQLServlet.doGet(GraphQLServlet.java:78) [magnolia-graphql-core-1.0-beta2.jar:?]
      

      Workaround

      In the "Query Variables" pane of GraphiQL, supply an empty object

      {}
      

      Notes

      GraphiQL is a very popular GUI for graphQL endpoints. It should work by default.

      I guess other GUI or usages will also stumble on this.

      If it does not cause problems, I suggest that we treat non-existing or null query varaibles as an empty map so that the query succeeds.

      Notes

      Run the attached simple-graphiql.html file on any web server. (Needs to run on a web server due to Magnolia CORS)

      Tweak the URL in the file to hit your instances graphql endpoint.

       

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                rsiska Robert Šiška
                czimmermann Christopher Zimmermann
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Checklists

                    Bug DoR
                    Task DoD