Skip to content

Cannot return null for non-nullable field Subscription.greeting #460

Answered by enisdenjo
jmc420 asked this question in Q&A
Discussion options

You must be logged in to vote

From #460 (reply in thread)

Its was because of yielding the field "greetings" while the actual field is called just "greeting" (singular).

const rootValue = {
    subscription: {
        greeting: async function* () {
            for (const hi of ['Hi', 'Bonjour', 'Hola', 'Ciao', 'Zdravo']) {
-                yield { greetings: hi };
+                yield { greeting: hi };
            }
        }
    }
}

Replies: 2 comments 11 replies

Comment options

You must be logged in to vote
11 replies
@jmc420
Comment options

@enisdenjo
Comment options

@jmc420
Comment options

@enisdenjo
Comment options

@jmc420
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by enisdenjo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #459 on March 07, 2023 20:33.