Prisma 1 Forum

Nexus not expose all functions, not able to call aggregation from nexus interface

I tried to follow the prisma guide and use nexus-prisma to expose all my queries and mutations in my graphql server as below.

const Query = prismaObjectType({
  name: "Query",
  definition: t => t.prismaFields(["*"])
});
const Mutation = prismaObjectType({
  name: "Mutation",
  definition: t => t.prismaFields(["*"])
});

It is possible to call the aggregation function directly from prisma server, but I could not access the aggregation function from web server, below is my gql.

{
  myquery: endPoints(first: 10, skip: 0) {
    id
    name
    type
    path
  }
  meta: endPointsConnection {
    aggregate {
      count
    }
  }
}

result of prisma server
image

result of my web server(as new comer, one image limited)

{
  "data": null,
  "errors": [
    {
      "message": "Unknown prisma-client function for field EndPointConnection.aggregate",
      "locations": [
        {
          "line": 9,
          "column": 5
        }
      ],
      "path": [
        "meta",
        "aggregate"
      ]
    }
  ]
}

anybody could help, thanks!

3 Likes

I have the same problem :confused:

I have exactly the same issue

Same here. It’s need to include connections someway separatly?

Same issue here. What is the best way to do pagination with prisma using nexus if this doesn’t work?

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