nestjs / graphql

GraphQL (TypeScript) module for Nest framework (node.js) 🍷
https://docs.nestjs.com/graphql/quick-start
MIT License
1.45k stars 391 forks source link

Cannot read property 'new' of undefined - enum-definition.factory #1307

Closed Krasnopir closed 3 years ago

Krasnopir commented 3 years ago

Please help. I try to run the project but getting error:

[ERROR]: Cannot read property 'new' of undefined

Stack:
TypeError: Cannot read property 'new' of undefined
at /usr/src/app/node_modules/@nestjs/graphql/dist/schema-builder/factories/enum-definition.factory.js:16:56
at Array.reduce (<anonymous>)
at EnumDefinitionFactory.create (/usr/src/app/node_modules/@nestjs/graphql/dist/schema-builder/factories/enum-definition.factory.js:15:49)
at /usr/src/app/node_modules/@nestjs/graphql/dist/schema-builder/type-definitions.generator.js:46:80
at Array.map (<anonymous>)
at TypeDefinitionsGenerator.generateEnumDefs (/usr/src/app/node_modules/@nestjs/graphql/dist/schema-builder/type-definitions.generator.js:46:35)
at TypeDefinitionsGenerator.generate (/usr/src/app/node_modules/@nestjs/graphql/dist/schema-builder/type-definitions.generator.js:24:14)
at GraphQLSchemaFactory.<anonymous> (/usr/src/app/node_modules/@nestjs/graphql/dist/schema-builder/graphql-schema.factory.js:39:43)
at Generator.next (<anonymous>)
at /usr/src/app/node_modules/tslib/tslib.js:114:75
at new Promise (<anonymous>)
at Object.__awaiter (/usr/src/app/node_modules/tslib/tslib.js:110:16)
at GraphQLSchemaFactory.create (/usr/src/app/node_modules/@nestjs/graphql/dist/schema-builder/graphql-schema.factory.js:29:24)
at GraphQLSchemaBuilder.<anonymous> (/usr/src/app/node_modules/@nestjs/graphql/dist/graphql-schema.builder.js:56:56)
at Generator.next (<anonymous>)
at /usr/src/app/node_modules/tslib/tslib.js:114:75

tried @nestjs/graphql versions since 7.7.0.

reproduce

"dependencies": { "@nestjs/common": "^7.4.2", "@nestjs/config": "^0.5.0", "@nestjs/core": "^7.4.2", "@nestjs/graphql": "^7.9.3", "@nestjs/microservices": "^7.2.0", "@nestjs/platform-express": "^7.2.0", "@nestjs/swagger": "^4.5.12", "@nestjs/terminus": "^7.0.1", "@nestjs/typeorm": "7.1.5", "@nestjsx/crud": "^4.4.1", "@nestjsx/crud-typeorm": "^4.4.1", ... "graphql": "15.4.0", "graphql-redis-subscriptions": "^2.3.1", "graphql-tools": "5.0.0", ... }, "devDependencies": { "@nestjs/cli": "^7.4.1", "@nestjs/schematics": "^7.0.1", "@nestjs/testing": "^7.2.0", ... },

node v14 tsconfig: { ... , "target": "es2018", ... }

kamilmysliwiec commented 3 years ago

Please provide a minimum reproduction repository.

Krasnopir commented 3 years ago

Sorry! problem was in other lib, that used old version. Need to be more careful in monorepositories