Skip to content
This repository has been archived by the owner on Dec 3, 2019. It is now read-only.

Getting a TypeError when rendering GraphiQL #230

Closed
bigblind opened this issue Aug 9, 2017 · 1 comment
Closed

Getting a TypeError when rendering GraphiQL #230

bigblind opened this issue Aug 9, 2017 · 1 comment

Comments

@bigblind
Copy link

bigblind commented Aug 9, 2017

I also submitted an issue to the GraphiQL repo, but since it's raised from within graphql-language-interface, I thought I'd repost it here.

I'm getting the following error:

Uncaught TypeError: Cannot read property '0' of undefined
    at getDiagnostics (getDiagnostics.js?6960:46)
    at eval (lint.js?eb0c:38)
    at startLinting (lint.js?af2c:147)
    at Object.eval [as lint] (lint.js?af2c:241)
    at new CodeMirror$1 (codemirror.js?f14e:7645)
    at CodeMirror$1 (codemirror.js?f14e:7590)
    at QueryEditor.componentDidMount (QueryEditor.js?39d7:115)
    at eval (ReactCompositeComponent.js?063f:264)
    at measureLifeCyclePerf (ReactCompositeComponent.js?063f:75)
    at eval (ReactCompositeComponent.js?063f:263)

In GetDiagnostics, the error happens in the last line of the following code:

try {
    ast = (0, _graphql.parse)(queryText);
  } catch (error) {
    var range = getRange(error.locations[0], queryText);

I'm trying to put a breakpoint ether at the start of the catch block, so I can se the original error, but Chrome's dev tools won't let me.

Putting a breakpoint on the ast = ... line, all local variables are undefined, except queryText, which is equal to:

 "# Welcome to GraphiQL
#
# GraphiQL is an in-browser tool for writing, validating, and
# testing GraphQL queries.
#
# Type queries into this side of the screen, and you will see intelligent
# typeaheads aware of the current GraphQL type schema and live syntax and
# validation errors highlighted within the text.
#
# GraphQL queries typically start with a "{" character. Lines that starts
# with a # are ignored.
#
# An example GraphQL query might look like:
#
#     {
#       field(arg: "value") {
#         subField
#       }
#     }
#
# Keyboard shortcuts:
#
#       Run Query:  Ctrl-Enter (or press the play button above)
#
#   Auto Complete:  Ctrl-Space (or just start typing)
#

"
@wincent
Copy link
Contributor

wincent commented Aug 22, 2017

Let's discuss this over on the GraphiQL issue. It may or may not be the right place for it, but at least it will be one place.

@wincent wincent closed this as completed Aug 22, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants