Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading query for ever when there are syntax errors #171

Closed
nicolaslopezj opened this issue Oct 14, 2016 · 2 comments · Fixed by #174
Closed

Loading query for ever when there are syntax errors #171

nicolaslopezj opened this issue Oct 14, 2016 · 2 comments · Fixed by #174

Comments

@nicolaslopezj
Copy link
Contributor

I've noticed that each time I run a query with a error it stays loading for a lot of time and then it responds:

TypeError: Failed to fetch
    at TypeError (native)

In the server it logs

(STDERR) GraphQL Error: Cannot query field "dme" on type "Query". Did you mean "me"?
(STDERR) GraphQL Error: Cannot read property '0' of undefined

I think we are missing a try/catch in the server.

I'm using Apollo with Meteor.

Is anyone else having this error?

@helfer
Copy link
Contributor

helfer commented Oct 14, 2016

@nicolaslopezj I'd be surprised if this was actually happening and we hadn't caught it yet, but it's certainly possible. Could you try and make a PR with a failing test? Thanks!

@nicolaslopezj
Copy link
Contributor Author

I did the test and it passed, took another look into my code and realized that I was having an error in the formatError function.

console.error(`GraphQL Error: ${error.message}`)
console.error(`At ${error.path[0]}`)

With no path, it was giving the error:

(STDERR) GraphQL Error: Cannot read property '0' of undefined

We should wrap formatError in try/catch to avoid this for other people.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants