Tag: nestjs
-
GraphQL not showing schema and documentation NestJS
0 I’m working on GraphQL using NestJS and I’ve not created models separately so, in short, I combine them but my GraphQL playground is not showing schemas and documentation of my queries and mutations. GraphQL Config { driver: ApolloDriver, autoSchemaFile: true, path: SERVER_PREFIX_URL, debug: true, playground: true, introspection: true, plugins: [ ApolloServerPluginQueryComplexity({ estimators: [directiveEstimator(), simpleEstimator()],…
-
Nest JS: Object is possibly ‘undefined’ in GraphQL
0 I tried to make the subscription update course in the nest js, but it turns out error Object is possibly ‘undefined’ in this line of code const course = await this.courseService.findOne({ id: variables.courseId }); below is my course.resolver.ts @Subscription(‘courseUpdated’, { resolve: (value) => value, filter: async (payload, variables) => { const course = await…
-
Error: “Query.getAllBooks” was defined in resolvers, but not in schema
0 I’m currently working on a small Nest.js application where I want to create a GraphQL query to retrieve an array of books. However, I’m encountering an issue where I’m not getting the expected response. I’ve provided the relevant code snippets below. Can someone please help me identify what I might be doing wrong? src/books/books.dto.ts…
-
How to map to timestamp when return data from database using nestjs and graphql
0 I use nestjs and graphql save data into postgres. When i save data it save success on my database. Here dto input @InputType() export class CreateShop { //some field @Field(() => String, { name: ‘opening_time’ }) openingTime?: Timestamp; @Field(() => String, { name: ‘closing_time’ }) closingTime?: Timestamp; } My data save success on database…
-
How to fix error output format in Nest.js + graphql?
0 Faced the problem of getting errors from graphql in nest.js when the data does not pass validation. I wrote a global filter to bring it all to a single format, but it doesn’t want to work, or rather it works, but graphql wraps everything in a bunch of data and originalError GraphQLModule.forRoot<ApolloDriverConfig>({ driver: ApolloDriver,…
-
updating record with typeORM transactions
0 I have quiz api in nestjs, i am using typeORM for saving data, I want to do following transaction: create quiz in quiz table with title and auto generated Id and empty array of questions for each question try to save question in data base with generated quiz_id and questions input save quiz and…
-
Getting error of Cannot read properties of undefined (reading ‘service’) when using i18n translation in nestjs with graphql
-1 i am using nest-i18n package to use localization in my project but when translating the message i get the error Cannot read properties of undefined (reading ‘service’) Here is my code please help me to find out the exact error Note:- I have tried to add I18nValidationPipe as a provider in app module as…
-
while sending array of enum i got Error from typescript graphql nestjs api
0 Question My Stack: BE NestJS, graphQL(code first approach), prisma / FE NextJS Problem: For my model "Conventions" all fields working to send from FE to GraphQL NestJS API, but one field uses an array of an enum Called "ConGenres" i am not able to figure out why it doesnt work this way: FE (NextJs)…
-
how to set proxy for apollo/client for server side nestjs
0 Resolver file @Resolver() export class LaunchResolver { private readonly client: ApolloClient<any>; constructor() { this.client = new ApolloClient({ uri: ‘https://spacex-production.up.railway.app/graphql’, cache: new InMemoryCache(), }); } @Query(‘launches’) async getLaunches(): Promise<Launch[]> { const response = await this.client.query({ query: gql` query GetLaunches { launches { mission_name launch_date_utc } } `, }); return response.data.launches; } } I am running…