Skip to content

Subscription Implementation with Prisma Binding #432

@redeguzman-gbf

Description

@redeguzman-gbf

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. :(

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions