Philipp Rajah Moura Srivastava
06/29/2020, 10:34 PMconst userUpdates = {
subscribe: async (parent, { id }, context, info) => {
// Function: userUpdates, a resolver function that subscribes to
// any changes made to a user.
//
// Parameter(s):
//
// parent, args, context, info - default prisma parameters
// args is an object containing the user Id
//
// Return Value(s):
//
// a subscription
// node: { id_contains: id },
return context.prisma.$subscribe.user({ node: { id: id }, mutation_in: ["UPDATED"] }).node();
},
resolve: (payload) => {
//returning payload
console.log("hi", "two")
return payload;
}
}
[8:59 PM] However I’m getting this error when I update a user (edited)
[8:59 PM] {
"errors": [
{
"message": "Cannot read property 'get' of undefined",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"userUpdates"
]
}
],
"data": null
}
[9:00 PM] I’m using prisma-client-library 1.34.10
[9:01 PM] I’m aware you can use PubSub from graphql-yoga to implement subscriptions so should I go that route or does anyone know a fix to this?Sachin Jani
06/30/2020, 7:36 AM