Not authorised when trying to use forwardTo

prisma

#1

I have the following code for my graphql query

export const Query = prismaObjectType("Query", t => {

  t.field("fonts", "Font", {
    list: true,
    resolve: (parent, args, ctx, info) => {
      return forwardTo("prisma")(parent, args, ctx, info);
      // console.log("Resovle fonts", ctx);
      // const result = ctx.prisma.fonts();
      // result.then(val => console.log(val));
      // return ctx.prisma.fonts();
    }
  });
})

However when I try to query the fonts endpoint I get a response of ‘Not Authorised!’. I removed my secret key for local development and still get the same issue. What am I doing wrong here?


#2

Hi,

Looks like you are using prisma nexus but you are using the API wrongly(it is understandable as it WIP and we don’t have any docs for it). We don’t provide forwardTo in nexus-prisma but we have a new API for exposing fields.

You can have a look here: https://codesandbox.io/s/github/prisma/nexus-prisma/tree/master/example