I am trying to filter the subscriptions to make sure each client only receives data they need. However, I get an error when I work with this implementation
/**
* Relevant packages and their versions
* "apollo-server-core": "^3.6.2",
* "apollo-server-koa": "^3.6.2",
* "graphql": "^16.3.0",
* "graphql-request": "^3.7.0",
* "graphql-subscriptions": "^2.0.0",
*
*
*/
const Subscription = {
agentLocation: {
type: AgentLocationType,
args: {
id: { type: GraphQLID },
},
resolve: (payload) => {
console.log(payload, ' is the payload')
return payload.agentLocation
},
subscribe: withFilter(
() => pubsub.asyncIterator('LOCATION_UPDATED'),
(payload, variables) => {
return payload.agentLocation.id === variables.id
}
),
},
}
Apollo studio shows this error
What am I doing wrong?