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.2Additional context
https://github.com/prisma/prisma-content-feedback/issues/10
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