Subscription Implementation with Prisma Binding

prisma

#1

Is there clear documentation on how to implement subscriptions with prisma-binding? I’m using prisma 1.34 and prisma-binding 2.3.15.

At the moment, I have a subscription that looks like this:

type Subscription {
  table: Table
}

and a resolver that looks like this

Subscription: {
    table: {
      subscribe: async (parent, args, ctx, info) => {
        return ctx.db.subscription.table({}, info);
      },
      resolve: payload => {
        return payload
      }
    }
  }

And I get this error:

{
  "errors": [
    {
      "message": "Unexpected error value: [{ message: \"Anonymous Subscription must select only one top level field.\" }]",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "table"
      ]
    }
  ]
}

I can’t find any documentation that clearly tackles this.


#2

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.