Tag: prisma-graphql
-
Prisma throws an error “TypeError: cannot read property findmany of undefined”
5 I wanted to make a chat app to practice working with graphql and node, for database I used prisma. I was doing everything like in this tutorial. https://www.howtographql.com/graphql-js/0-introduction/ I just changed variable names. so I have this code const { PrismaClient } = require(‘@prisma/client’) const prisma = new PrismaClient() const resolvers = { Query:…
-
TypeError with Pothos Graphql and prisma-plugin
0 I am building a social app with nextjs for frontend and SSR, graphql-yoga server, and pothos for typesafe graphql and prisma for my db. I have followed all the example given in all their documentation for integration. However, I am getting a confusing error. ERR Error: Type Post must define one or more fields.…
-
Remove all items in table with Prisma2 and Jest
2 I would like to know how can I remove all items in table with Prisma2 and Jest ? I read the CRUD documentation and I try with this : user.test.js …. import { PrismaClient } from "@prisma/client" beforeEach(async () => { const prisma = new PrismaClient() await prisma.user.deleteMany({}) }) … But I have an…
-
CORS blocks mutation in GraphQL Yoga
6 I am working here with a graphql prisma backend and a graphql yoga express server on top of that. In the frontend, I am trying to call a signout mutation but its blocked by the CORS policy. Though I have added cors settings in my graphql yoga server, I keep getting this error. GraphQL…
-
How to set timeout to graphql-client
7 I’m trying to set timeout with prisma-labs/graphql-request. I’ve tried the way described here – https://github.com/prisma-labs/graphql-request/issues/103. const client = new GraphQLClient(config.url, { timeout: 30000, headers: { Authorization: `Bearer ${token}` } }) My compiler complains as timeout is not directly present in Options interface – https://github.com/prisma-labs/graphql-request/blob/master/src/types.ts#L7. Should I need to extend the Options interface to use…
-
Resolve relationships in graphql using nexus
0 I’m new to using nexus and graphql but I’m having a hard time getting the following to work: I am using: "@prisma/client": "^5.4.1", "apollo-server": "^3.12.1", "graphql": "^16.8.1", "nexus": "^1.3.0", "python": "^0.0.4" And this is running in a node container (node:20-alpine3.17) My data model: I defined the types and some query definitions using the nexus…
-
Multi database support in prisma
0 I have 3 databases in my project. Every database has different data. But they have some relation between them. For example on the transaction database in my transaction, it has a userId stored and in the Default database User table has this user. Now how to manage these multi-database and cross-relation between databases in…
-
How to reference prismaObject type for a objectType field with pothos graphql
0 I have my User object made based off of my prisma schema. I’m trying to create a RegisteredUserRes objectType where the field createdUser should be of type User from my prismaObject. How can I do that? import { builder } from ‘../builder’; import type PrismaTypes from ‘@pothos/plugin-prisma/generated’; builder.prismaObject(‘User’, { fields: t => ({ id:…