You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 20, 2023. It is now read-only.
Hi - I'm using some various packages to try and get a graphql server up and running: type-graphql to generate my schema, and prisma to connect to my database. Everything is working fine but it seems express doesn't have access to the prisma client. Do you know what i am doing wrong?
Error: Unable to find Prisma Client in GraphQL context. Please provide it under the context[\"prisma\"] key
import express from "express";
import "reflect-metadata";
import { PrismaClient } from "@prisma/client";
import { resolvers } from "@generated/type-graphql";
import { buildSchema } from "type-graphql";
import { graphqlHTTP } from "express-graphql";
(async () => {
const prisma = new PrismaClient();
const schema = await buildSchema({
resolvers,
validate: false,
});
const app = express();
app.use(
"/graphql",
graphqlHTTP({
schema,
context: () => ({ prisma }),
graphiql: true,
})
);
app.listen(3000, () => {
console.log(`Example app listening on port 3000`);
});
})();
The text was updated successfully, but these errors were encountered:
Hi - I'm using some various packages to try and get a graphql server up and running: type-graphql to generate my schema, and prisma to connect to my database. Everything is working fine but it seems express doesn't have access to the prisma client. Do you know what i am doing wrong?
Error:
Unable to find Prisma Client in GraphQL context. Please provide it under the context[\"prisma\"] key
The text was updated successfully, but these errors were encountered: