Tag: nestjs
-
Graphql Subscriptions field must return Async Iterable. Received: { pubsub
0 I’m trying go use subscriptions in graphql, but I’m receiving this weird error: subscription { notification { type message } } I’m using import { PubSub } from "graphql-subscriptions"; import { Inject } from "@nestjs/common"; import { Resolver, Subscription } from "@nestjs/graphql"; import { PubSub } from "graphql-subscriptions"; import { Notification } from "./models/notification";…
-
Allowing unrequired lists in graphql
-1 type Participants @entity(immutable: true) { id: String! games: [Games] # array of games they are a part of } this returns the error Participants: – Field ‘games’: Field has type [Games] but must have type [Games!] Reason: Lists with null elements are not supported. see in my contract when a participant in initialized he…
-
Submission error! response.header is not a function in nest-fastify graphql
0 I need set header autorization client. But have error in my Mutation "Submission error! response.header is not a function". my main.ts async function bootstrap() { const app = await NestFactory.create<NestFastifyApplication>( AppModule, new FastifyAdapter(), ); await app.enableCors({ origin: true, methods: ‘GET,HEAD,PUT,PATCH,POST,DELETE,OPTIONS’, credentials: true, }); await app.useGlobalPipes(new ValidationPipe({ stopAtFirstError: true })); await app.register(fastifyCookie, { secret: ‘secret’,…
-
How to provide resolvers from different files to the apollo server (nestjs)
0 I have nestjs quiz api which serves graphql queries and mutations, i have two resolvers (for questions and quizes). To the apollo server i need schema which i have from autoSchema but i dont know how to provide this resolvers without constructors Below my three files (main.ts / quiz.resolver.ts / question.resolver.ts) import { NestFactory…
-
NestJS – Avoid returning user’s password
2 I have a little problem with my project using GraphQL and Mongoose (code-first approach). I have a findCurrentUser query in my user’s resolver that returns the information about the currently authenticated user, but I don’t want to return the user’s password, how I can avoid this? User’s Resolver: @Query(() => User) @UseGuards(GqlAuthGuard) async findCurrentUser(@CurrentUser()…
-
How to fix empty schema.gql file?
0 I want to connect my frontend with backend by apollo server. Schema is generated in backend main folder and i have following settings: app.module: GraphQLModule.forRoot<ApolloDriverConfig>({ driver: ApolloDriver, autoSchemaFile: "schema.gql", sortSchema: true, playground: false, }), main.ts: import { NestFactory } from ‘@nestjs/core’; import { GraphQLSchemaHost } from ‘@nestjs/graphql’; import { AppModule } from ‘./app.module’; import…
-
Bcrypt with graphQL and nestJS
0 In NestJS and GraphQL while using Bcrypt I had to use it with promise like below async getUser(email: String, password: String) { let user: User[] | User | null = await this.userModel.find({ email }); user = user.length && user[0]; if (user) { return bcrypt .compare(password, user.password) .then((res: any) => { if (res) { return…
-
Validation error with zodValidationPipe in nestjs
0 I have the following graphql. input UpdateStudentInput { name: String motherName: String birthDate: String gender: Gender email: String password: String avatar: String } And I have the following mutation: updateStudent(updateStudentInput: UpdateStudentInput!, studentId: String): Student! but when I try to mutate I get a validation error : mutation { updateStudent(updateStudentInput: { name: "Abner Matheus Gomes…
-
How to merge application resolvers with dynamic resolver in NestJS using ApolloFederationDriver
0 I am developing an application that requires dynamic schema using NestJS and the Apollo GraphQL module that comes integrated with it. To achieve this, I am creating type definitions and resolvers based on user configuration. Everything works correctly when I use the ApolloDriver, but when I switch to the ApolloFederationDriver, problems arise. Let me…
-
Implementing GraphQL stitch with RabbitMQ in NestJS
0 I’m working on a NestJS task where I must use GraphQL stitching with RabbitMQ. I actually have explored various options, however am having trouble finding clean and exact commands on a way to obtain this integration. problem: I want to set up a microservices architecture using GraphQL stitching, and I’ve chosen RabbitMQ as the…