Questions tagged [typegraphql]

TypeGraphQL is a library that provides you some decorators, and you can use these decorators to define your parts of schema.

typegraphql
Filter by
Sorted by
Tagged with
0 votes
1 answer
711 views

error TS2339: Property 'filter' does not exist on type 'DataSource<{ Cards: Card[]; }>

I'm building a simple GraphQL API using typescript and I'm running into the error above and having issues resolving. The resolver is supposed to take in an argument so that users can look for a ...
Jessica Feliciano's user avatar
3 votes
0 answers
993 views

Apollo=Express GraphQL error, cannot find module graphql

I am trying to set up a graphql express server with apollo, express, typeorm, and graphql, however I am getting this error now that I have implemented the UserResolver.ts file. I have already tried ...
Vikram Ganesan's user avatar
2 votes
2 answers
850 views

how to protect user data from eachother using typegraphql-prisma

I'm building a server based off typegraphql-prisma like here: https://github.com/prisma/prisma-examples/tree/latest/typescript/graphql-typegraphql-crud I now have a server where different Users can ...
dsmurl's user avatar
  • 123
2 votes
2 answers
3k views

Input extend other input on graphql schema

Is it possible any input extend other input on graphql schema? example below: input PaginationInput{ pageSize: Int pageNum: Int } # // example for extending input Pagination input ...
Dilermando Lima's user avatar
1 vote
0 answers
428 views

How to inject a value via middleware into a graphql query body (prisma-typegraphql)?

I am currently using prisma-typegraphql for generating a schema and it's props. Problem: Is there a way to write a middleware that accesses a value from an arbitrary source, then injects that into the ...
Thall's user avatar
  • 51
2 votes
1 answer
1k views

Cannot return null for non-nullable field in mikro orm graphql

I am trying to make a Graphql server with Mikro-orm and having a problem. Here's my Product.ts entity; import { Entity, IdentifiedReference, ManyToOne, PrimaryKey, ...
Pranta's user avatar
  • 3,346
0 votes
1 answer
681 views

Use mercurius, fastify with typegraphql make an error

I am trying to use typegraphql with mercurius and fastify I have copied this intergration from mercurius documentaion, when I add the built schema to mercurius it show me an error in this way: When I ...
Ghyath Darwish's user avatar
0 votes
0 answers
507 views

TypeGraphQL Field Resolver returns undefined

I have built my back-end with Typegoose+TypeGraphQL. I have an ObjectType that looks like this: I want workoutAmount to pretty much just return the length of workouts array. The array always exists, ...
Didzis's user avatar
  • 166
1 vote
1 answer
354 views

applyResolversEnhanceMap not adding custom decorators to resolvers?

I'm using the typegraphql-prisma package and am trying to apply custom decorators to my generated resolvers to no avail. I'm trying to wrap my head around the bottleneck, but can't seem to identify it....
Californium's user avatar
9 votes
1 answer
3k views

Incompatible versions of GraphQL and TypegraphQL

Error: Looks like you use an incorrect version of the 'graphql' package: "16.0.1". Please ensure that you have installed a version that meets TypeGraphQL's requirement: "^15.3.0". ...
imback0526's user avatar
1 vote
1 answer
324 views

Apollo Server has no socket connection

I have a GraphQL server running with Type-GraphQL + Apollo and so I want to use a subscription. For the frontend I am using NextJS + Apollos client and I am getting following error: WebSocket ...
ExZeMIP's user avatar
  • 13
1 vote
0 answers
401 views

How to configure graphql subscription in apollo server with nextjs

Below is the code to configure the apollo server in the Next js application. import "reflect-metadata"; import { ApolloServer, PubSub } from "apollo-server-micro"; import { ...
user1927603's user avatar
1 vote
1 answer
36 views

TypeGraphQL_How to avoid creating fields that have not been inputted

@Resolver() export class NameCardCreateResolver { @Mutation(() => BaseMutationResponse) async namecardCreate( @Arg("chosenSNSUrls", () => SNSInput) { facebook, twitter, ...
yl K's user avatar
  • 51
0 votes
0 answers
426 views

TypeORM: how to call mutation from another mutation within the resolver

How do I call a mutation from another mutation within the same resolver in TypeORM if the function requires context as an argument? Something like: @Mutation() async addNote( @Ctx() { req }: ...
 HigoChumbo 's user avatar
0 votes
1 answer
434 views

How to differentiate between a resolver call from federation and from client?

I am working in a GraphQL project using node + typegraphql + apollo-server. My goal is to have specific metrics for regular queries, and separately, from federations. Is it possible to differentiate ...
Marc Pascual's user avatar
1 vote
1 answer
445 views

Error when I use subscriptions in ApolloGraphQL with TypeGraphQL: UnsupportedProtocolError: Unsupported protocol "ws:"

I simply don't have any idea what's going on, could someone help me? The Queries and Mutations are working as like a charm, but the subscription are not. Do I need configure something in my computer? ...
Henrique's user avatar
0 votes
2 answers
2k views

TypeGraphql Field and Arg decorators using custom type

I'm trying to build a resolver using type-graphql library and found that I can't define custom argument type. Here is my code: type Hits = { [K: string]: string | number } @Resolver() export default ...
lutaev's user avatar
  • 317
1 vote
1 answer
2k views

When insing TypeORM and TypeGraphQL, Where do the ({nullable: true}) options go and what's the difference?

I'm working with a server app that uses both TypeORM and Type-GraphQL. @Field({ nullable: true }) @Column({ nullable: true }) url?: string; When I run GraphQL queries (using Apollo Studio) ...
Peter Jaffray's user avatar
-2 votes
1 answer
510 views

error: error: syntax error at or near "Oct" Postgres db

I am getting this error "error: error: syntax error at or near "Oct" whenever I want to create a new post in my postgres db using apollo graphql and typeorm. I have checked the code ...
niel_morphius's user avatar
0 votes
1 answer
1k views

Unable to infer GraphQL type from TypeScript reflection system. Provide explicit type for 'list_of_coordinate_ids' of 'UpdateCoordinatesInput' class

This error is arising solely because of my incorrect usage of list_of_coordinate_ids as an "array of strings". Rest of the code is working fine. This is the entity aka model file. import { ...
Ankit Sanghvi's user avatar
2 votes
1 answer
2k views

TypeORM does not make further query for nested object

I'm currently using PostgresQL with typeORM, as well as Typegraphql. With the ManyToOne (User has many orderItems) relationship, somehow I cannot query for the nested object relation. I set the ...
Kittichote Chain's user avatar
1 vote
0 answers
874 views

GraphQL 'CannotDetermineGraphQLTypeError: Cannot determine GraphQL output type' error while using TypeGraphQL and TypeORM

I'm trying to execute simple query using GraphQL with TypeORM and TypeScript which would fetch every record from database Photo table, but I'm getting this error: CannotDetermineGraphQLTypeError: ...
FewArc's user avatar
  • 11
1 vote
1 answer
531 views

Can't create a new test Apollo Server

I would like to test my resolvers with the executeOperation API, according to the docs I need to create a test server, here's mine. export const getTestServer = async () => { const redis = new ...
Jeremy's user avatar
  • 1,577
1 vote
1 answer
602 views

Is it semantically correct to use ID scalar type for a foreign key field in a Type-graphql and Typeorm entity?

Here's the definition of String and ID from GraphQL's documentation: GraphQL comes with a set of default scalar types out of the box: String: A UTF‐8 character sequence. ID: The ID scalar type ...
RedGiant's user avatar
  • 4,616
1 vote
1 answer
1k views

GraphQL - defining types

I'm trying to follow Ben Awad's lireddit tutorial. At the time he made the tutorial, there may have been different inferences about Field types. I'm trying to add a Field to my relationship attribute (...
Mel's user avatar
  • 2,595
-2 votes
1 answer
3k views

Type for JSON field on Type-GraphQL

I'm defining a custom input field on type-graphql of type JSON. We're using Prisma as well. I tried with Prisma.JsonValue, Prisma.JsonObject and JSON but I get this errors. any suggestion will be ...
Minor Vargas's user avatar
0 votes
1 answer
3k views

GraphQLDocumentError: Unknown type "Int"

I am trying to follow Ben Awad's lireddit tutorial. At 6.49, he demonstrates how to assign a type to an argument where it's needed to override a default expected value. The resolver has: @Resolver() ...
Mel's user avatar
  • 2,595
3 votes
2 answers
1k views

Reading request headers from type-graphql resolvers with ApolloServer

I am following this example that uses Prisma ORM, ApolloServer and type-graphql to make a simple blog web app. I want to inspect the HTTP request headers and I'm having trouble working out how to ...
simj's user avatar
  • 295
1 vote
1 answer
1k views

ConnectionManager error using typeorm implementing typedi

I was trying to use typeorm with typedi, and there were some problem. I want to use typeorm for ORM, typegraphql for GraphQL, and DI for typedi. And now I'm trying to implementing typedi with typeorm, ...
Keum Jung Bin's user avatar
2 votes
2 answers
1k views

"Single source of truth" schema/validation class for server (NestJs/GraphQL/TypeGraphQL/Prisma) and client (NextJs)

I'm building an Typescript application using an NX monorepo, NestJs/GraphQL/TypeGraphQL (built into @nestjs/graphql)/Prisma/PostgreSQL on the server, and NextJs on the client. With this stack (when ...
Will Despard's user avatar
1 vote
2 answers
6k views

How to return the entity with its relations after saving it?

I am building a storage application, with GraphQL as the backend, using Typegraphql and TypeORM. The categories need to be added separately and then when adding a product, you choose from a dropdown ...
Stoyko Tolev's user avatar
2 votes
2 answers
1k views

passing multiple arguments along with `GraphQLUpload` in type-graphql mutations

I'm implementing a mutation for uploading photo with type-graphql, and I also want to get another argument like and ID: @Mutation(() => GraphQLJSON) async userUploadPostPhoto( @Arg("...
Emad Baqeri's user avatar
  • 2,592
0 votes
0 answers
784 views

TypeORM: Updating columns data

I have a situation where i'm trying to update columns in typeorm. I have a 1-to-1 relationship between my User entity and Profile entity. How can I update the profile of the user based on the ...
crispengari's user avatar
  • 8,711
0 votes
1 answer
76 views

do TypeGraphQl automatic format the SQL query or not?

i use typeorm combine with TypeGraphQl. i want to know what the SQL query result provided by TypeGraphQl for example if i have a User Table with a lot of columns and i have this simple resolver. @...
ucup's user avatar
  • 675
1 vote
2 answers
1k views

Field can only be defined once graphql

I have 2 subgraphs I have this code in the subgraph for template and fileserver I call buildFederatedSchema 2 time since I have 2 subgraphs in the server list this the code in modified ...
Generic Technology's user avatar
1 vote
2 answers
2k views

ApolloServer schema option

I'm watching a youtube fullstack tutorial on react, graphQL, typeScript and on the apollo server part i try to pass buildSchema(function from type-graphql) in the schema option and get this error ...
senpai's user avatar
  • 134
0 votes
1 answer
1k views

How to use an optional order parameter in a query using Typescript and TypeORM

I'm using the most recent version of Graphql, Typescript, type-graphql and TypeORM. I set up basic CRUD and now want to add the functionality to optionally sort the output of my query to get all ...
GoWithTheFlow's user avatar
0 votes
1 answer
1k views

File uploads with typegraphql (Apollo Server)

What I am trying to do I am trying to get file uploads working with typegraphql (wrapper on Apollo Server). I am writing a simple resolver that should receive a file upload and write it to a file on ...
Simon Verhoeven's user avatar
0 votes
1 answer
227 views

Can not Query all users because of MongoDB id

I am coding a CRUD API built in TypeScript and TypeGoose. I get an error saying, CannotDetermineGraphQLTypeError: Cannot determine GraphQL output type for '_id' of 'User' class. Is the value, that is ...
Sub-Zero's user avatar
0 votes
1 answer
249 views

Subscription onConnect return value not appended to context

I am using type-graphql to create a GraphQL endpoint, which also defines a subscription. In subscription I am returning an object that contains currentUser property. This is how I am creating the ...
Abhilash D K's user avatar
  • 1,281
0 votes
1 answer
284 views

Type-graphql, Mikororm Query returns Ref<User> rather than User

I am working with a project backend of creating a clone version of Reddit using Mikro-ORM, Type-graphql, NodeJs, Express, Redis, and PostgreSQL This is my Initial Project Setup with Mikororm, connect ...
Quan Nguyen's user avatar
2 votes
0 answers
263 views

How to access Query parameters in FieldResolver

Using type-graphql I am trying to build an entry-point that returns me a List entity with its meta info like name, description, etc. and also a computed field content, that supposed to contain ...
SmxCde's user avatar
  • 5,183
1 vote
1 answer
119 views

experimentalDecorators error in typegrapql

I am currently learning TypeGraphQL and trying to create a basic reslover, my code looks like this: @Resolver() class HelloReslover { @Query(() => String) async hello(){ return &...
damjance's user avatar
1 vote
1 answer
207 views

typeGraphql how to change message for Field validation

I am using an InputType with Fields: @InputType('RegisterInput') export default class RegisterInput { @Field({nullable: true}) username: string @Field({nullable: true}) password: ...
ivaylo's user avatar
  • 841
1 vote
0 answers
593 views

creating apollo-express-server with typescript and type-graphql error

I'm trying to set up an apollo server and an error shows up. import { createConnection } from "typeorm"; import { Post } from "./entity/Post"; const express = require("express&...
Bruno Aburto's user avatar
2 votes
0 answers
922 views

"Cannot POST /api/graphql" with Vercel Apollo Server (Serverless)

I am trying to setup a severless Apollo server with Vercel, TypeGraphQL & TypeORM (postgres). To do so, I followed a few tutorials, and all of them suggest using the apollo-server-micro module as ...
lbragile's user avatar
  • 7,831
0 votes
1 answer
10k views

Object literal may only specify known properties, and 'clientId' does not exist in type 'RatesWhereUniqueInput'

I'm using typescript with prisma and typegraphql and getting this type error. RatesWhereUniqeInput is generated by prisma and is defining itself as a "CompoundUniqueInput" because the ...
Jason Maynard's user avatar
1 vote
1 answer
455 views

After switchinng to graphql 15.5.1 returning an empty array results in a "cannot return null value" error

EDIT: You can skip to the end for a simplified example of the error in codesandbox I'm upgrading my apollo project to the new version of graphql and I'm getting a weird error. Can't find any results ...
Supperhero's user avatar
  • 1,051
0 votes
0 answers
230 views

Graphql Mysql - Get rows from a table in JSON Format

I'm working on Backend with TypeGraphQL and NodePostGres. User will pass database id and table name. I need to send data in JSON Format. I have tried below code but it doesn't return anything nor does ...
TechGeek's user avatar
  • 2,192
0 votes
0 answers
388 views

Why does field of extended type resolve to null? - Apollo Federation

Consider 2 services (A and B). B extends a type that is defined in A, but also adds a new field that's not in A. However, the resolvers in A that return that type don't resolve that field that B ...
Chris Krogh's user avatar

1 2 3
4
5
8