rmosolgo/graphql-ruby

Upgrade to 2.3.8 breaks subscriptions in the schema

aub opened this issue · 3 comments

aub commented

Describe the bug

I've upgraded to 2.3.8, and after doing so I started getting errors when trying to use the introspected schema for type generation in my react app. The error it's giving me is:

✖ Unable to find root schema type for operation type "subscription"!

I did some debugging to see what's being returned in the introspection query, and the things at the top of the response have changed from this:

{"__schema"=>{"queryType"=>{"name"=>"Query"}, "mutationType"=>{"name"=>"Mutation"}, "subscriptionType"=>{"name"=>"Subscription"} ....

to this

"__schema"=>{"queryType"=>{"name"=>"Query"}, "mutationType"=>{"name"=>"Mutation"}, "subscriptionType"=>nil

Note the change to "subscriptionType" => nil. I haven't changed anything in my code, only updated the version of the gem. My app does include subscriptions, with a base type like this:

module Types
  class SubscriptionType < GraphQL::Schema::Object
    field :all_articles, subscription: Subscriptions::AllArticlesSubscription, null: true
    .....
  end
end

And this is included in the schema like so:

subscription(Types::SubscriptionType)

Versions

graphql version: 2.3.8

rails (or other framework): 7.1.3.4

Derp, so sorry! This is due to a typo here: https://github.com/rmosolgo/graphql-ruby/pull/4998/files#diff-1665674fd4d2e7c4ad535e2ed497fca9f91f41902c382a1c3c9a5a3d4ed32aafR53

Thanks so much for reporting this issue. I'll work up a patch and release soon.

I just shipped 2.3.9 with a fix for this issue. Thanks again for reporting it and please let me know if it gives you any more trouble!

aub commented

@rmosolgo nice, thanks for the updates and for getting it fixed!