graphql-ruby: TypeError: Cannot read property 'types' of undefined when completeing tutorial on https://www.howtographql.com/graphql-ruby/2-queries/

I followed all the steps until the end of the https://www.howtographql.com/graphql-ruby/2-queries/ and instead of seeing the documentation in the graphiql UI it will throw an error in the right panel of the graphiql:

TypeError: Cannot read property 'types' of undefined
    at buildClientSchema (http://localhost:3000/assets/graphiql/rails/graphiql-0.12.0.self-84a2376c545f0620e86ec9d8681863a2f1b56b5eb3fe74c45003ff1fb982c1a3.js?body=1:33481:72)
    at http://localhost:3000/assets/graphiql/rails/graphiql-0.12.0.self-84a2376c545f0620e86ec9d8681863a2f1b56b5eb3fe74c45003ff1fb982c1a3.js?body=1:2174:55

Any idea if I did something wrong or is there something in the tutorial that needs to be updated?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 17

Most upvoted comments

Circling back, I was migrating from a REST based API to Graphql. My old project had a middleware (https://github.com/vigetlabs/olive_branch) which I had forgotten to disable, so this was causing it to auto change snake case (which it identified __schema as snake case) to CamelCase. My bad about this, but wanted to follow up in case anyone else had issues, maybe check your middlewares.

I also found you can receive this if you dont pass null: true|false to a field.

I got this error but it turned out to be a mistake with the type of one of the fields I declared.

Ok thanks so I have to change to basenode instead great will try that

Hey, I opened a PR which fixes this issue 👉 https://github.com/howtographql/howtographql/pull/897