newrelic / nr1-graphiql-notebook

NR1 Graphiql Notebook allows you to explore New Relic data via our GraphQL API and share notebooks with colleagues.
https://discuss.newrelic.com/t/graphiql-notebook-nerdpack/82933
Apache License 2.0
9 stars 9 forks source link

Fails to return Graphql results #58

Closed aswanson-nr closed 2 years ago

aswanson-nr commented 3 years ago

Description

Some queries throw a JS error and never return results. While I use the example notebook for the example below, I also observed this behavior with a new notebook.

First example fails:

Screen Shot 2021-04-01 at 10 59 37 AM

With a JS error

Screen Shot 2021-04-01 at 11 00 57 AM

Second example works fine:

Screen Shot 2021-04-01 at 10 59 58 AM

Steps to Reproduce

  1. Open the Graphql Notebook
  2. Run the first example
  3. Notice that it never returns results

Expected Behaviour

The Graphql results are displayed.

Relevant Logs / Console output

Your Environment

aswanson-nr commented 3 years ago

After further investigation, this appears to have something to do with the NerdGraphQuery module from the nr1 package. When querying for something like

{
    actor {
        user {
           name
        }
   }
}

The correct values are returned, but they include an extra id field for the user, which breaks the response parsing of this application.

rudouglas commented 2 years ago

I resolved this issue by first checking if there was a contextNode object, and then checking if it had contextNode.context, this has resolved the issue