I really think there is a big problem with prisma ...
# orm-help
d
I really think there is a big problem with prisma client and subscription: First problem I notice is there is actually no way to return directly the full subscription payload like
Copy code
type PostSubscriptionPayload {
  mutation: MutationType!
  node: Post
  updatedFields: [String!]
  previousValues: PostPreviousValues
}
Because when I try with something like that in the resolver
return ...prisma.$<http://subscribe.post|subscribe.post>()
and I console log the returned payload of this, I get
PostSubscriptionPayload
but only
updatedFields
and
mutation
fields are set correctly, the other fields remains null, whatever is the event (creation, delete, update). Second problem, and this is a big one because it concerns the DELETE subscription, we can't get back the previous value of the deleted node at all! If I try
ctx.prisma.$<http://subscribe.post|subscribe.post>({ mutation_in: ['DELETED'] }).previousValues()
with
Copy code
type Subscription {
  deletedPost: PostPreviousValues! // I tested with Post! too, same error
}
I get
null
Note that I console log the payload in the
resolve
function of each subscription resolver like
Copy code
deletedPost: {
    subscribe: async (parent, args, ctx) => {
      return ctx.prisma.$<http://subscribe.post|subscribe.post>({ mutation_in: ['DELETED'] }).previousValues()
    },
    resolve: payload => {
      console.log(payload)
      return payload
    }
  }
So I'm pretty sure the problem comes from prisma Client 🤪 prisma 1.19 (docker image as well)