graphql-ruby icon indicating copy to clipboard operation
graphql-ruby copied to clipboard

TypeError: Cannot read property 'types' of undefined on tutorial https://www.howtographql.com/graphql-ruby/7-filtering/

Open mazelka opened this issue 5 years ago • 1 comments

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.

mazelka avatar Apr 19 '20 16:04 mazelka

in link_search.rb:
class Resolvers::LinksSearch type types[Types::LinkType] to:
class Resolvers::LinksSearch < GraphQL::Schema::Resolver type [Types::LinkType], null: false

DokuroGitHub avatar Mar 12 '22 13:03 DokuroGitHub