Tag: Node.Js
-
Validation Error: Using global entity manager instance methods for context specific actions is disallowed
20 Using MikroORM and getting this error: ValidationError: Using global EntityManager instance methods for context specific actions is disallowed. If you need to work with the global instance’s identity map, use `allowGlobalContext` configuration option or `fork()` instead The code that it corresponds to is below: import { MikroORM } from "@mikro-orm/core"; import { __prod__ }…
-
Cannot read properties of undefined (reading ‘isAuth’) in React and GraphQL application
0 I’m encountering an error when trying to create a post in my React application using a GraphQL mutation. The error message is: { "errors": [ { "message": "Cannot read properties of undefined (reading ‘isAuth’)", "status": 500 } ], "data": { "createPost": null } } This suggests that the req.isAuth property is undefined when the…
-
Implementing Middleware to Retrieve JWT Tokens from Header in a GraphQL Server with Node.js and Apollo
0 I’m trying to create a middleware to receive a token from the header, but it never seems to trigger, and I never see the ‘hello’ log message I inserted at the top of the middleware. const jwt = require(‘jsonwebtoken’); const { GraphQLError } = require(‘graphql’); module.exports = async ({ req }) => { console.log(‘hello’);…
-
Circular modules: Expected {} to be a GraphQL type
0 I came across this issue called module cycles when requiring modules. Im working on a small star wars graphql api and ill explain in short where i got the issue : I have two type : filmType and charecterType: film.js: const axios = require("axios"); const { GraphQLObjectType, GraphQLString, GraphQLInt, GraphQLList, } = require("graphql"); const…
-
415 status code from from simple graphql-http setup
0 I was scanning over the graphql docs to find express-graphql deprecated so I decided to implement the recommended graphql-html version: this is my server.js: import { createHandler } from "graphql-http/lib/use/express"; import { buildSchema } from "graphql"; import http from "http"; import fs from "fs"; import path from "path"; const __filename = new URL(import.meta.url).pathname; const…
-
Prisma query returns null, when data exists
2 I’ve built a Nestjs app with Prisma and GQL. I just changed computer (from a Mac to PC) and all of a sudden my login mutation seems to have stopped working, literally the only one… Here is some code: auth.resolver.ts: @Mutation((returns) => AuthenticatedUser) async login( @Context() { res }: Auth.GqlContext, @Args(‘payload’, { type: ()…
-
can’t persist user session in apollo-graphql with express-session
0 I have nextjs-nodejs project, where I use apollo-graphql and Prisma, so when I create a user, I should send a session to "getSession" function, which is a mutation, and this mutation uses express-session to save the user info like that: getSession: async ( _: any, args: any, { prisma, session }: GraphqlContext ) =>…
-
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:…