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

Incompatibility with graphql-ruby 2.0.18+ #87

Open
swrobel opened this issue Mar 19, 2023 · 5 comments
Open

Incompatibility with graphql-ruby 2.0.18+ #87

swrobel opened this issue Mar 19, 2023 · 5 comments

Comments

@swrobel
Copy link

swrobel commented Mar 19, 2023

It seems there was a breaking change introduced in 2.0.18 that causes use BatchLoader::GraphQL to cause the following exception:

vendor/bundle/ruby/3.2.0/gems/graphql-2.0.19/lib/graphql/schema.rb:944:in `tracer': Can't add tracer after configuring a `trace_class`, use GraphQL::Tracing::LegacyTrace to merge legacy tracers into a trace class instead.
  raise ArgumentError, "Can't add tracer after configuring a `trace_class`, use GraphQL::Tracing::LegacyTrace to merge legacy tracers into a trace class instead."
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (ArgumentError)
from vendor/bundle/ruby/3.2.0/gems/batch-loader-2.0.1/lib/batch_loader/graphql.rb:10:in `use'
from vendor/bundle/ruby/3.2.0/gems/graphql-2.0.19/lib/graphql/schema.rb:243:in `use'
@chriswright47
Copy link

I'm also seeing this issue in my application. I am working around it for the moment by locking the graphql gem version to 2.0.17:

gem "graphql", "~> 2.0", "<= 2.0.17"

@sodabrew
Copy link

Is it broken specifically with that version, or with all onwards versions? (did graphql-rb revert this?)

@pravi
Copy link

pravi commented Jul 25, 2024

There are other breaking changes too, with graphql 2.2.5, I see


An error occurred while loading /<<PKGBUILDDIR>>/spec/batch_loader/middleware_spec.rb.
Failure/Error: use GraphQL::Execution::Interpreter

NoMethodError:
  undefined method `use' for GraphQL::Execution::Interpreter:Class

            plugin.use(self)
                  ^^^^
# /usr/share/rubygems-integration/all/gems/graphql-2.2.5/lib/graphql/schema.rb:317:in `use'
# /<<PKGBUILDDIR>>/spec/fixtures/graphql_schema.rb:37:in `<class:GraphqlSchemaWithInterpreter>'
# /<<PKGBUILDDIR>>/spec/fixtures/graphql_schema.rb:36:in `<top (required)>'
# /<<PKGBUILDDIR>>/spec/spec_helper.rb:12:in `require_relative'
# /<<PKGBUILDDIR>>/spec/spec_helper.rb:12:in `<top (required)>'
# /<<PKGBUILDDIR>>/spec/batch_loader/middleware_spec.rb:1:in `<top (required)>'

An error occurred while loading /<<PKGBUILDDIR>>/spec/batch_loader_spec.rb.
Failure/Error: query QueryType

GraphQL::Error:
  Second definition of `query(...)` (QueryType) is invalid, already configured with QueryType
# /usr/share/rubygems-integration/all/gems/graphql-2.2.5/lib/graphql/schema.rb:418:in `query'
# /<<PKGBUILDDIR>>/spec/fixtures/graphql_schema.rb:31:in `<class:GraphqlSchema>'
# /<<PKGBUILDDIR>>/spec/fixtures/graphql_schema.rb:30:in `<top (required)>'
# /<<PKGBUILDDIR>>/spec/spec_helper.rb:12:in `require_relative'
# /<<PKGBUILDDIR>>/spec/spec_helper.rb:12:in `<top (required)>'
# /<<PKGBUILDDIR>>/spec/batch_loader_spec.rb:1:in `<top (required)>'

An error occurred while loading /<<PKGBUILDDIR>>/spec/graphql_spec.rb.
Failure/Error: query QueryType

GraphQL::Error:
  Second definition of `query(...)` (QueryType) is invalid, already configured with QueryType
# /usr/share/rubygems-integration/all/gems/graphql-2.2.5/lib/graphql/schema.rb:418:in `query'
# /<<PKGBUILDDIR>>/spec/fixtures/graphql_schema.rb:31:in `<class:GraphqlSchema>'
# /<<PKGBUILDDIR>>/spec/fixtures/graphql_schema.rb:30:in `<top (required)>'
# /<<PKGBUILDDIR>>/spec/spec_helper.rb:12:in `require_relative'
# /<<PKGBUILDDIR>>/spec/spec_helper.rb:12:in `<top (required)>'
# /<<PKGBUILDDIR>>/spec/graphql_spec.rb:1:in `<top (required)>'
No examples found.


@exAspArk
Copy link
Owner

Sorry, I don't have the bandwidth to address this issue right now. Please feel free to submit a pull request, and I'd be happy to review and merge it 🙏

@boutil
Copy link

boutil commented Dec 15, 2024

It seems that applying:

--- a/spec/fixtures/graphql_schema.rb
+++ b/spec/fixtures/graphql_schema.rb
@@ -34,8 +34,6 @@
 
 if defined?(GraphQL::Execution::Interpreter)
   class GraphqlSchemaWithInterpreter < GraphQL::Schema
-    use GraphQL::Execution::Interpreter
-    use GraphQL::Analysis::AST
     query QueryType
     use BatchLoader::GraphQL
   end

is enough to make the test suite pass with ruby3.1

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

No branches or pull requests

6 participants