Urigo / merge-graphql-schemas

A utility library to facilitate merging of modularized GraphQL schemas and resolver objects.
https://www.npmjs.com/package/merge-graphql-schemas
929 stars 66 forks source link

TypeError: graphql.getDescription is not a function #415

Closed lukeypap closed 3 years ago

lukeypap commented 3 years ago

Got this error when trying to generate typings using the definitionsFactory. UnhandledPromiseRejectionWarning: TypeError: graphql.getDescription is not a function

any ideas?

Thanks

evereq commented 2 years ago

@lukeypap did you solve that issue?

We recently got a similar one after updating GraphQL related packages in a very large project...

Our stack trace is following:

TypeError: graphql.getDescription is not a function
    at pushComment (e:\Coding\Ever\ever\node_modules\@nestjs\graphql\dist\merge\src\typedefs-mergers\comments.js:32:21)
    at collectComment (e:\Coding\Ever\ever\node_modules\@nestjs\graphql\dist\merge\src\typedefs-mergers\comments.js:8:5)
    at e:\Coding\Ever\ever\node_modules\@nestjs\graphql\dist\merge\src\typedefs-mergers\merge-nodes.js:16:17
    at Array.reduce (<anonymous>)
    at mergeGraphQLNodes (e:\Coding\Ever\ever\node_modules\@nestjs\graphql\dist\merge\src\typedefs-mergers\merge-nodes.js:11:18)
    at mergeGraphQLTypes (e:\Coding\Ever\ever\node_modules\@nestjs\graphql\dist\merge\src\typedefs-mergers\merge-typedefs.js:58:25)
    at mergeTypeDefs (e:\Coding\Ever\ever\node_modules\@nestjs\graphql\dist\merge\src\typedefs-mergers\merge-typedefs.js:10:22)
    at GraphQLTypesLoader.mergeTypesByPaths (e:\Coding\Ever\ever\node_modules\@nestjs\graphql\dist\graphql-types.loader.js:20:42)
    at GraphQLModule.onModuleInit (e:\Coding\Ever\ever\node_modules\@nestjs\graphql\dist\graphql.module.js:90:27)
    at Object.callModuleInitHook (e:\Coding\Ever\ever\node_modules\@nestjs\core\hooks\on-module-init.hook.js:51:9)
    at NestApplication.callInitHook (e:\Coding\Ever\ever\node_modules\@nestjs\core\nest-application-context.js:169:13)
    at NestApplication.init (e:\Coding\Ever\ever\node_modules\@nestjs\core\nest-application.js:97:9)
    at NestApplication.listen (e:\Coding\Ever\ever\node_modules\@nestjs\core\nest-application.js:156:33)

I don't see how it's related to merge-graphql-schemas (more like in our case it's coming from @nestjs\graphql), but we are using @graphql-tools/merge too in our project... so not sure...

UPDATE: issue solved by downgrading graphql package from version 16.0.1 to version 15.7.2 :)

lukeypap commented 2 years ago

@evereq

The only solution that worked for me too :)