graphql-ruby
graphql-ruby copied to clipboard
TypeError: Cannot read property 'types' of undefined on tutorial https://www.howtographql.com/graphql-ruby/7-filtering/
I've following steps in tutorial page https://www.howtographql.com/graphql-ruby/7-filtering/ and after changing field :all_links, resolver: Resolvers::LinksSearch in query_type.rb got an error
TypeError: Cannot read property 'types' of undefined
at buildClientSchema (http://localhost:3000/assets/graphiql/rails/application.debug-3aff84d172cfc9d5cfec9289f9417ad7ee0ecdb1e7414d33c11cac078d02875e.js:34100:72)
at http://localhost:3000/assets/graphiql/rails/application.debug-3aff84d172cfc9d5cfec9289f9417ad7ee0ecdb1e7414d33c11cac078d02875e.js:2793:55
I've spent some time and found that issue is in link_search.rb file.
After changing line type types[Types::LinkType] to type [Types::LinkType] (according to readme in https://github.com/rstankov/SearchObjectGraphQL) everything started working fine.
in link_search.rb:
class Resolvers::LinksSearch
type types[Types::LinkType]
to:
class Resolvers::LinksSearch < GraphQL::Schema::Resolver
type [Types::LinkType], null: false