Tag: nestjs
-
onConnvect, graphql-ws subscription
0 thank you for your time, my problem is that i want to return the data to the client immediately after subscribing. I know about the onConnect method, but it is called before JwtAuthGuard. What is the best way to do this? I was thinking of moving the authorization logic to onConnect. To better understand…
-
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: ()…
-
What’s the advantages of pre-fetching the GraphQL schema when we can manually pass data to request body?
0 Foreword: I am completely new to GraphQL so I am just trying to figure out what is the best practice when working with it So I need to call a GraphQL API written in Nestjs (more specifically, from a Rails server). There is this nice gem graphql-client that makes a Client to communicate with…
-
How can I use Prisma types on a nest.js GraphQL query argument
0 I’m working on a simple GraphQL query that allows me to fetch a list of users. I want to be able to sort them through my request. I’m using Prisma as an ORM. As per the documentation, my service simply looks like this: /** * Find all users */ findAll({ skip, take, cursor, where,…
-
How to have an offset paginated query and a cursor paginated query with Nestjs-query?
1 I’m using nestjs-query, and I have an entity (TodoItem). I would like to generate 2 resolvers/queries to fetch many todos: A cursor paginated one An offset paginated one. This is what I did: resolvers: [ { DTOClass: TodoItemDTO, EntityClass: TodoItemEntity, create: { disabled: true }, update: { disabled: true }, delete: { disabled: true…
-
Dictionary in GraphQL resolver of NestJS
1 In my NestJS project I’m creating a GraphQL endpoint for a service that returns a dictonary object: { [key: number]: MyDataDto } In my .interfaces.ts file I would like to have something like: interface ArrayAsObject<T> { [key: number]: T } @ObjectType() export class MyDataDtoAsDictionary implements ArrayAsObject<MyDataDto> { @Field(() => MyDataDto) [key: number]: MyDataDto }…
-
Error from a non-sharable field defined in a subgraph that shoudn’t have this field
1 I have multiple GraphQL microservices (subgraphs, using ApolloFederationDriver) with a GraphQL gateway (using ApolloGatewayDriver) I have a really strange bug since I’ve upgraded my GraphQL microservices and gateway to use @apollo/server (@nestjs/graphql@11 + @nestjs/apollo@11) : I have an error when my subgraphs are composed telling me that subgraph A has a non shareable field…
-
I am getting an error when using nestjs-tenancy with mongoose and graphql
0 With basic setup as outlined in the docs https://github.com/needle-innovision/nestjs-tenancy module doesn’t work with nestjs and graphql. After little debugging I found that "getTenantFromRequest" in the TenancyCore module called twice. In first call req was available and I was able to capture the header. But in the second call req was null. Which case tenantId…
-
How to disable graphql playground?
0 My angular application is configured with graphql which by default enabled with playground, how to disable it? following is my package.json "dependencies": { "@nestjs/common": "^7.0.8", "@nestjs/core": "^7.0.8", "@nestjs/graphql": "^7.3.4", "@nestjs/microservices": "^7.0.8", "class-transformer": "^0.2.3", "class-validator": "^0.12.2", "graphql": "^14.0.0", "reflect-metadata": "^0.1.12", "rxjs": "^6.0.0" } and Dockerfile FROM node:16 RUN mkdir -p /testappservice/app COPY dist/apps/testappservice-container testappservice/app COPY…
-
How To Config Apollo Sandbox for GraphQL in NestJS?
1 I am trying to use Apollo Sandbox for GraphQL in NestJs since I had to upgrade to apollo/server from apollo-server-express. I added the configuration like described in the NestJS docs. I also checked the Apollo Docs. My setup is now like described here. Here is what I use: "@apollo/server": "^4.7.3", "@apollo/server-plugin-landing-page-graphql-playground": "^4.0.1", "@nestjs/apollo": "^11.0.6",…