Hi, im getting the following error message ``` TSE...
# orm-help
m
Hi, im getting the following error message
Copy code
TSError: ⨯ Unable to compile TypeScript
src/index.ts (6,34): Argument of type '{ typeDefs: string; resolvers: { Query: { users: (parent: any, args: any, context: any, info: Gra...' is not assignable to parameter of type 'Props'.
  Types of property 'resolvers' are incompatible.
    Type '{ Query: { users: (parent: any, args: any, context: any, info: GraphQLResolveInfo) => any; profil...' is not assignable to type 'IResolvers'.
      Property 'Query' is incompatible with index signature.
        Type '{ users: (parent: any, args: any, context: any, info: GraphQLResolveInfo) => any; profiles: (pare...' is not assignable to type '(() => any) | IResolverObject | GraphQLScalarType'.
          Type '{ users: (parent: any, args: any, context: any, info: GraphQLResolveInfo) => any; profiles: (pare...' is not assignable to type 'GraphQLScalarType'.
Quite interestingly, this only happens when I run the server locally, not when I deploy to now. Why could this be happening? This is how some of the resolvers look:
Copy code
export const Query = {
  users: forwardTo("db"),
  profiles: forwardTo("db"),
  posts: forwardTo("db"),
  events: forwardTo("db"),
  venues: forwardTo("db"),
  artists: forwardTo("db"),

  profile(parent, { id }, ctx: Context, info) {
    return ctx.db.query.profile({ where: { id } }, info);
  },
  async me(parent, args, ctx: Context, info) {
    const id = await getUserId(ctx);
    return ctx.db.query.user({ where: { id } }, info);
  },
@nilan this is the same issue I encountered a few days ago. Do you have any idea where this might be coming from? This seems to have arisen with a prisma-binding upgrade. My deployment in now is still working fine, this is only a local issue. Im very confused.
b
the signature of your resolvers is different than expected. I had this error when I used graphql-shield to wrap my resolvers. add the
"noEmitOnError": false
to your tsconfig.json to override
m
Thanks @Bryan. Unfortunately, that did not help. Do i have to register changes to the `tsconfig`somehow or should they get picked up automatically? I just ran another yarn dev afterwards and the same thing came up again.
n
I gave some pointers on this in the last discussion, did you check them again? 🙂
m
Hi, yes I did. I am overriding all the types in my schema. Beyond that, I dont really know how to interpret it.
n
the underlying issue is a mismatch between the expected resolver signature vs the
forwardTo
signature from
prisma.ts
for the
users
resolver.
There are many possible ways to end up here, so which one it might be depends on your specific project 🙂
something that is always very helpful in such a situation is a minimal reproduction, so someone can take a look at this problem and triage it.
m
Copy code
users(
    where: UserWhereInput
    orderBy: UserOrderByInput
    skip: Int
    after: String
    before: String
    first: Int
    last: Int
  ): [User]!
I understand 🙂 Sorry to ask so bluntly. I am under a bit of time pressure. I thought there might be a known workaround.
Copy code
Property 'name' is missing in type
Do you have any idea what this tells me?
n
There might be 🙂 I haven't seen this specific error before.
I have very little context. But somewhere some type is defined without a
name
field, but somewhere else the
name
field is expected.
that are TS types.
m
Ok thanks nilan, once again sorry for the lack of background. I will see what I can do and if I cant get around I will create a reproducable example on Thursday and ping you if thats all right. Thanks!
👌 1
n
Hey @Moritz did you learn more about this?
m
Hi @nilan, I managed to workaround it somehow, though I really cannot tell you how exactly. My linter is still complaining about type mismatch mentioned above.
About this part.
Copy code
const server = new GraphQLServer({
  typeDefs: "./src/schema.graphql",
  resolvers,
  context: req => ({
    ...req,
    db: new Prisma({
      endpoint: process.env.PRISMA_ENDPOINT, // the endpoint of the Prisma DB service (value is set in .env)
      secret: process.env.PRISMA_SECRET, // taken from database/prisma.yml (value is set in .env)
      debug: true // log all GraphQL queries & mutations
    })
  })
});
and the related types, like posted above.
However, my local server is running again, though I have no idea what did the trick... I tried to create a reproducable example, but did not succeed, since resolver forwarding works fine on the boilerplate... Since the issue did not hinder my development any longer, and I am currently swamped with work, I did not pursue it further. Would be glad if someone finds a solution though.