Prisma1: prisma client $graphql is not a function

Created on 10 Oct 2018  路  8Comments  路  Source: prisma/prisma1

Describe the bug
There is currently no way to run raw GraphQL request using Prisma Client. This seems to be a missing feature, and also a problem in the documentation, for which I created a separate issue here.

To Reproduce
Run

  const a = await prisma.$graphql(`query { users { id } }`)
  console.log(a)

The error will be printed:

TypeError: prisma.$graphql is not a function

The same for prisma.request, prisma.request and prisma.graphql. To the best of my knowledge, it should be prisma.$graphql.

Expected behavior
The raw GraphQL request is executed.

Versions (please complete the following information):

  • prisma CLI: prisma/1.19.0-beta.2

Additional context
https://github.com/prisma/prisma-content-feedback/issues/10

bu2-confirmed areclienjs

All 8 comments

So the documentation is just wrong? Do you have a workaround until the fix is implemented?

There is no workaround; but the fix will be merged soon into beta: https://github.com/prisma/prisma/pull/3297.

How could I help to make this fix move faster? it's a blocker to me. I can't create many records in a single transaction.

Be patient 馃檪

Okay! Thanks. I really like prisma 馃檪

So I just discovered that this works fine with the latest prisma client

    // @ts-ignore
    const data = await prisma.client.request(query);

Good catch! To my understanding, that is an undocumented API though, so don't rely on it being stable.

Fixed via #3297

Was this page helpful?
0 / 5 - 0 ratings

Related issues

notrab picture notrab  路  3Comments

thomaswright picture thomaswright  路  3Comments

marktani picture marktani  路  3Comments

sorenbs picture sorenbs  路  3Comments

akoenig picture akoenig  路  3Comments