MichalLytek / typegraphql-prisma

Prisma generator to emit TypeGraphQL types and CRUD resolvers from your Prisma schema
https://prisma.typegraphql.com
MIT License
891 stars 113 forks source link

CannotDetermineGraphQLTypeError: Cannot determine GraphQL input type for 'take' #347

Closed ToP29 closed 1 year ago

ToP29 commented 1 year ago

Describe the Bug When I try to start the server from example number 1 it throws this error. CannotDetermineGraphQLTypeError: Cannot determine GraphQL input type for 'take' of 'AggregatePostArgs' class. Is the value, that is used as its TS type or explicit type, decorated with a proper decorator or is it a proper input value? Everything was working before, than i had to delete node modules and install them again and it started throwing this error.

To Reproduce create project from example number 1, run prisma generate and try to run the server

Expected Behavior It should not throw this error

Logs

CannotDetermineGraphQLTypeError: Cannot determine GraphQL input type for 'take' of 'AggregatePostArgs' class. Is the value, that is used as its TS type or explicit type, decorated with a proper decorator or is it a proper input value?
    at Function.getGraphQLInputType (C:\Users\ToP\Projekty\culinix-v4\apps\graphql-server\node_modules\type-graphql\dist\schema\schema-generator.js:540:19)
    at C:\Users\ToP\Projekty\culinix-v4\apps\graphql-server\node_modules\type-graphql\dist\schema\schema-generator.js:485:28
    at Array.forEach (<anonymous>)
    at Function.mapArgFields (C:\Users\ToP\Projekty\culinix-v4\apps\graphql-server\node_modules\type-graphql\dist\schema\schema-generator.js:481:29)
    at C:\Users\ToP\Projekty\culinix-v4\apps\graphql-server\node_modules\type-graphql\dist\schema\schema-generator.js:474:22
    at Array.reduce (<anonymous>)
    at Function.generateHandlerArgs (C:\Users\ToP\Projekty\culinix-v4\apps\graphql-server\node_modules\type-graphql\dist\schema\schema-generator.js:452:23)
    at C:\Users\ToP\Projekty\culinix-v4\apps\graphql-server\node_modules\type-graphql\dist\schema\schema-generator.js:398:28
    at Array.reduce (<anonymous>)
    at Function.generateHandlerFields (C:\Users\ToP\Projekty\culinix-v4\apps\graphql-server\node_modules\type-graphql\dist\schema\schema-generator.js:390:25)

Environment (please complete the following information):

MichalLytek commented 1 year ago

Have you run the examples on the repo or just created your fresh project by copying the source code?

Have you done all the installation steps for TypeGraphQL itself? https://typegraphql.com/docs/installation.html

Looks like you forgot about proper setup of tsconfig to emit type metadata.

ToP29 commented 1 year ago

Good point, I didnt do TypeGraphQL installation itself. Now I installed all required modules, and also noticed that there is some mismatch in graphql version with some required peer dependencies, so i downgraded it to 15.8.0 and everything is working now. Thank you very much for help :)