graphql-devise / graphql_devise

GraphQL interface on top devise_token_auth
MIT License
200 stars 39 forks source link

Uninitialized constant `GraphqlDevise::SchemaPlugin` After trying to mount `graphql_devise` in my schema #270

Closed Forison closed 6 months ago

Forison commented 6 months ago

Hello team

I am currently working with graphql_devise. I have been attempting to mount graphql_devise in my schema. According to the documentation, I can do that by placing this code inside my schema like this

class ProjectGesSchema < GraphQL::Schema
  use GraphqlDevise::SchemaPlugin.new(
    query: Types::QueryType,
    mutation: Types::MutationType,
    public_introspection: true,
    resource_loaders: [
      GraphqlDevise::ResourceLoader.new(User,
                                        only: %i[register])
    ]
  )

For some reason I get uninitialized constant GraphqlDevise::SchemaPlugin

Do I have to define this class on my own??

Please does anyone knows why this is occurring?

00dav00 commented 6 months ago

Hi @Forison, did you execute the install command? What are the steps that you have followed so far to include the gem in your project?

Forison commented 6 months ago

Hello @00dav00, Thanks for the feedback I executed the command as described in the docs. For clarification here are the steps I took after creating my rails project

# ON THE FIRST LINE OF THE SCHEMA
 use GraphqlDevise::SchemaPlugin.new(
    query: Types::QueryType,
    mutation: Types::MutationType,
    public_introspection: true,
    resource_loaders: [
      GraphqlDevise::ResourceLoader.new(User,
                                        only: %i[register])
    ]

This resulted in uninitialized constant GraphqlDevise::SchemaPlugin The gem in my project are

gem 'graphql', '~> 2.3'
gem "graphql_devise", "~> 0.11.4"
Forison commented 6 months ago

Hello @00dav00 and any other person who runs into this same issue, To resolve this I had to downgrade graphql to version 2.2 and upgrade graphql_devise to version 1.4.0. This is because graphql version 2.3 is compatible with 0.11.4 only

00dav00 commented 6 months ago

Thanks for posting the solution @Forison !

mcelicalderon commented 6 months ago

@00dav00 I think we should yank gem versions that were published before we introduced strict version requirements for dependencies. This has happened before.

And we should also add support for GraphQL 2.3