Closed jmc420 closed 1 year ago
I am getting "Cannot return null for non-nullable field Subscription.greeting" returned to Postman when I invoke a subscription:
Schema looks like this:
const gql = ` type Query { sayHello: String! } type Mutation { sendMessage(message:String!):String ! } type Subscription { greeting: String! } `;
The resolver looks like this:
const rootValue = { subscription: { greeting: async function* () { for (const hi of ['Hi', 'Bonjour', 'Hola', 'Ciao', 'Zdravo']) { yield { greetings: hi }; } } } }
The full code of the example can be found here:
https://github.com/jmc420/graphql_examples/blob/main/graphql-ws/src/server.ts
I am getting "Cannot return null for non-nullable field Subscription.greeting" returned to Postman when I invoke a subscription:
Schema looks like this:
The resolver looks like this:
The full code of the example can be found here:
https://github.com/jmc420/graphql_examples/blob/main/graphql-ws/src/server.ts