-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Describe the bug
We were working on upgrading graphql-ruby gem but during the process we faced with few frictions that we would like to report.
For the background: we were using graphql@2.3.22 version, and graphql-pro@1.27.1 version.
Our first attempt was to upgrade to graphql@2.5.14. Besides some clear errors we faced with these ones:
Minitest::UnexpectedError:RuntimeError: GraphQL::Execution::Interpreter::Resolve.resolve_all is deprecated; Use `dataloader.run` instead.
/workspace/vendor/gems/3.4.7/ruby/3.4.0/gems/graphql-pro-1.27.1/lib/graphql/pro/defer.rb:212:in 'GraphQL::Pro::Defer::Deferral#resolve_lazies'
/workspace/vendor/gems/3.4.7/ruby/3.4.0/gems/graphql-pro-1.27.1/lib/graphql/pro/defer.rb:178:in 'block in GraphQL::Pro::Defer::Deferral#resolve'
/workspace/vendor/gems/3.4.7/ruby/3.4.0/gems/graphql-2.5.14/lib/graphql/dataloader/null_dataloader.rb:43:in 'block in GraphQL::Dataloader::NullDataloader#run_isolated'
/workspace/vendor/gems/3.4.7/ruby/3.4.0/gems/graphql-2.5.14/lib/graphql/dataloader/null_dataloader.rb:56:in 'GraphQL::Dataloader::NullDataloader#append_job'
/workspace/vendor/gems/3.4.7/ruby/3.4.0/gems/graphql-2.5.14/lib/graphql/dataloader/null_dataloader.rb:42:in 'GraphQL::Dataloader::NullDataloader#run_isolated’
For a query:
query($id: ID!) {
node(id: $id) {
... on Issue {
title
body @defer
author @defer {
login
profileUrl
}
}
}
}
Seeing those errors are backtraced to graphql-pro-1.27.1, we upgraded it to graphql-pro@1.29.14. But in a combination with graphql@2.5.14 we started seeing these errors for persisted queries integration tests:
Minitest::UnexpectedError:SystemStackError: 9873 -> 251
lib/json/active_support_patch.rb:31:in 'ActiveSupport::JSON.encode'
lib/json.rb:37:in 'Space::JSON#encode'
controllers/application_controller/react_dependency.rb:400:in 'block (3 levels) in ApplicationController::ReactDependency#render_react_app'
packages/react/app_renderer.rb:123:in 'block in React::AppRenderer#render'
packages/react/ssr_renderer.rb:127:in 'block (2 levels) in React::SsrRenderer#render'
packages/react/ssr_renderer.rb:311:in 'React::SsrRenderer#track_rails_render_time'
packages/eact/ssr_renderer.rb:126:in 'block in React::SsrRenderer#render'
packages/react/ssr_renderer.rb:320:in 'React::SsrRenderer#track_react_render_time'
packages/react/ssr_renderer.rb:117:in 'React::SsrRenderer#render’
This seems like infinite recursion with JSON encoding.
After some experimentation, we found 2 versions that are compatible with each other: graphql@2.5.11 and graphql-pro@1.29.12.
With this pair there is no recursion issue or defer issue. We believe there is something in those 2 gems that makes higher version incompatible.
Versions
graphql@2.5.14
graphql-pro@1.29.14