anyone can link a working example repo using prism...
# orm-help
k
anyone can link a working example repo using prisma + apollo server + subscriptions? I'm trying to set the context using:
Copy code
onConnect: (connectionParams: any, webSocket) => {
  return {
    foo: 'bar',
}
But the
context
is undefined in the subscription resolver.
👍 1
c
k
this uses graphql-yoga but I'm using apollo server 2..
The
onConnect
method is called but the object I return from it is not showing up the the resolver, e.g.:
Copy code
export const Subscription = {
  newUsers: {
    subscribe: (parent, args, ctx: Context, info: GraphQLResolveInfo) => {
      console.log(parent, args, ctx)
      return ctx.db.subscription.user({}, info)
    },
  },
}
ctx is always
undefined
okay, I think I figured it out
thanks for the help
c
Please post here and so maybe others can see the solution
k
I had to return
connection.context
from the
context:
method because
onConnect
runs before the
context: