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

The field 'viewer' of the subscription root type 'Subscription' must have StreamResolver set. #267

Open
floge07 opened this issue Dec 12, 2024 · 5 comments

Comments

@floge07
Copy link

floge07 commented Dec 12, 2024

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?

@floge07
Copy link
Author

floge07 commented Dec 12, 2024

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.

@floge07 floge07 changed the title Schema invalid with newest versions (StreamResolver error) The field 'viewer' of the subscription root type 'Subscription' must have StreamResolver set. Dec 12, 2024
@floge07
Copy link
Author

floge07 commented Dec 12, 2024

Looks similar: #258

@floge07
Copy link
Author

floge07 commented Dec 12, 2024

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.

@Shane32
Copy link
Member

Shane32 commented Dec 13, 2024

Sorry, I know little about the Conventions project, and it seems you have a solution anyway.

@floge07
Copy link
Author

floge07 commented Dec 13, 2024

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.

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

2 participants