The field 'viewer' of the subscription root type 'Subscription' must have StreamResolver set.
Hello,
I tried to update our GraphQL packages:
From: GraphQL: 7.2.0 GraphQL.Server.Transports.AspNetCore: 7.1.1 GraphQL.Convetions: 7.0.0
To: GraphQL: 8.2.1 GraphQL.Server.Transports.AspNetCore: 8.2.0 GraphQL.Convetions: 8.0.0
And now I'm seeing the following error, all graphql execution fails.
Error executing document. The schema is invalid. See inner exceptions for details. (The field 'viewer' of the subscription root type 'Subscription' must have StreamResolver set.) (The field 'method1' of an Object type 'SubscriptionViewer' must not have StreamResolver set. You should set StreamResolver only for the root fields of subscriptions.) (The field 'method2' of an Object type 'SubscriptionViewer' must not have StreamResolver set. You should set StreamResolver only for the root fields of subscriptions.) (The field 'method3' of an Object type 'SubscriptionViewer' must not have StreamResolver set. You should set StreamResolver only for the root fields of subscriptions.) (The field 'method4' of an Object type 'SubscriptionViewer' must not have StreamResolver set. You should set StreamResolver only for the root fields of subscriptions.)
*I censored the field names.
What exactly does this mean? What of the types would you need to see to trace this issue?
Our Root GraphQL Types (Queries, Mutations, Subscriptions) on different services inherit from a base class (which defines some common things). Is this a problem?
Ok, now I tried to use all the latest 7.x releases. Similar problem but smaller error message.
Error executing document. The field 'viewer' of the subscription root type 'Subscription' must have StreamResolver set.
Looks similar: #258
I solved it by removing
[ImplementViewer(OperationType.Subscription)]
[ImplementViewer(OperationType.Query)]
[ImplementViewer(OperationType.Mutation)]
from the root types... I don't even remember what this was for.
Sorry, I know little about the Conventions project, and it seems you have a solution anyway.
Well I leave it to you to figure out what to do with this problem. Whether this is wrong or intended behavior, or whether you simply mention it in some migration guide.
One last question though, if someone could answer what these were even for, that would be helpful. Always scary to remove something in a big code base, which on first glance didn't change anything.