Questions tagged [nestjs-graphql]
43 questions
6
votes
0 answers
nestjs + apollo graphql federated gateway can't introspect services because of "bad request", reproducible git repository available
In an NX monorepo I'm building 3 nestjs application, an auth-service + user-service and a gateway to start off with. They're all powered by apollo graphql and following the official nestjs documentation.
The issue that I'm having is that with both…

SebastianG
- 8,563
- 8
- 47
- 111
4
votes
1 answer
nestjs graphql subscription how to get context/pass data to resolver or interceptor?
I'm trying to use NestJS subscriptions, I have tried both graphql-ws and subscriptions-transport-ws.
I have a very basic use case -- an interceptor to take the authorization header and then set the user object on the connection or request object to…

SebastianG
- 8,563
- 8
- 47
- 111
2
votes
0 answers
GraphQLError: Type must define one or more fields
Problem
When I try to start this Federated Property Service, I get an error that says: GraphQLError: Type Property must define one or more fields.
The Schema that it generates looks correct, and has those fields populated, but when I add the…

farmlandbee
- 345
- 1
- 3
- 14
2
votes
0 answers
Context in resolve in NestJS Graphql Subscription is undefined
I just can't get my head around this issue. I read through the docs of @nestjs/graphql, and even checked type-graphql for comparison.
I have this Subscription that I need to get access to request's cookie in it, therefore I pass the request as…

moonman
- 21
- 1
2
votes
0 answers
Prisma client generated type for create input has weird type requirement for related table field, how to get a working type?
Use case is simple:
users table
sessions table
Each user can be logged in multiple places therefore they can have multiple sessions -> one to many relationship. in SQL this isn't a big deal/problem, but the generated types available in…

SebastianG
- 8,563
- 8
- 47
- 111
2
votes
1 answer
Nestjs graphql playground "Server cannot be reached"
I have a v9 Nestjs, graphql that works locally without any issues but when deployed on a digital ocean droplet with nginx, accessing playground says Server cannot be reached. And as such the Schema and Doc tabs on the playground don't load. However,…

Nditah
- 1,429
- 19
- 23
2
votes
0 answers
NestJS + Vite + Graphql, playground loads once but then immediately throws "Schema must contain uniquely named type" reproducible git repo inside
I've been trying to get this combination working for a while and fiddled with versions & compatibilities issue until I've hit this brick wall.
The app works in production once you build it -- it appears to solely be a vite issue when running in…

SebastianG
- 8,563
- 8
- 47
- 111
2
votes
2 answers
nestjs + Passport + GqlAuthGuard produces Cannot read property 'logIn' of undefined
I have followed the nestjs example of how to integrate passport with apollo but it constantly crashes with the following exception when I call a guarded resolver.
Looking into it in detail when the @nestjs/passport auth-guard class is extended, it…

ptheofan
- 2,150
- 3
- 23
- 36
1
vote
1 answer
Could not resolve dependency while upgrading node from `v14.17.6` to `v18.16.1`
In our code, we use node 14.17.6 and want to upgrade v18.16.1. But when we upgrade and run npm install it is showing following error:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving:…

sonnet
- 15
- 4
1
vote
0 answers
Does NestJS execute resolvers of ObjectTypes when they are used as a fields of another ObjectType
Consider an ObjectType, as such:
@ObjectType()
@KeyFields('id') // wrapper to create federation directive
export class MyInterestingThing {
@Field(type => ID)
id: string;
@Field()
someField: string;
@Field(type => SomeDetails)
…

Ryan Shohoney
- 81
- 1
- 7
1
vote
0 answers
How do I reuse ResolveField in different Resolvers?
In my app, I have priority field which has it's own resolver.
That priority field is used in technology. Something like this:
type Technology {
id: Int!
name: String!
priority: Priority!
}
type Priority {
id: Int!
name: String!
}
So in…

Alex Tarasenko
- 719
- 6
- 9
1
vote
1 answer
Graphql subscription in playground during local development throwing "Could not connect to websocket endpoint" in basic nestjs project
This is happening on a simple project during local development, so cloud infrastructure isn't an issue.
This is also happening in the application playground.
My module registration:
GraphQLModule.forRootAsync({
driver:…

SebastianG
- 8,563
- 8
- 47
- 111
1
vote
1 answer
nx + nestjs + graphql and code first seems broken, throws 'status is not defined' for a simple health check, repository inside
I'm trying to build a monorepo of nestjs + svelte applications using nx, generated all applications and libraries using the CLI/nx commands.
Initially I thought this error is because the model is imported from a shared library but then I moved the…

SebastianG
- 8,563
- 8
- 47
- 111
1
vote
0 answers
NestJS GraphQL inconsistent autoSchemaFile and service sql
I'm using nestJS with ApolloFederationDriver. I also add some prefix with transformSchema option. The issue is that in sdl I can't see that prefix, but in the autoSchemaFile he is. It is a problem, because I can't create connection between this…

Евгений Богданов
- 11
- 2
1
vote
1 answer
Validation of args passed to generic mutation in base resolver
Current behavior
I have a base class and some derived classes
There is a BaseResolver, which is inherited by the resolvers of the derived classes
Inside the BaseResolver, there is a create mutation
This create mutation takes in different arguments…

Snigdha Singh
- 98
- 7