Nest автоматически заполняет graphql.options.ts неизвестной схемой

Я просто следил за документацией и приложил prisma к своему проекту гнезда. Проблема в том, что когда я запускаю yarn start:dev, он заполняет graphql.options.ts какой-то неизвестной схемой и выдает следующую ошибку:

[nodemon] starting `ts-node -r tsconfig-paths/register src/main.ts`
[Nest] 50392   - 12/24/2018, 10:08:57 PM   [NestFactory] Starting Nest application...
[Nest] 50392   - 12/24/2018, 10:08:57 PM   [InstanceLoader] AppModule dependencies initialized +43ms
[Nest] 50392   - 12/24/2018, 10:08:57 PM   [InstanceLoader] PrismaModule dependencies initialized +0ms
[Nest] 50392   - 12/24/2018, 10:08:57 PM   [InstanceLoader] UsersModule dependencies initialized +1ms
[Nest] 50392   - 12/24/2018, 10:08:57 PM   [InstanceLoader] GraphQLModule dependencies initialized +0ms
(node:50392) UnhandledPromiseRejectionWarning: Error: Interface field Vehicle.wheels expects type Int but Car.wheels is type String.

Interface field argument Vehicle.stuff(a:) expects type Int but Car.stuff(a:) is type String.
    at assertValidSchema (/Users/pubudu/Projects/nest-prisma-sample/node_modules/graphql/type/validate.js:71:11)
    at assertValidExecutionArguments (/Users/pubudu/Projects/nest-prisma-sample/node_modules/graphql/execution/execute.js:146:35)
    at executeImpl (/Users/pubudu/Projects/nest-prisma-sample/node_modules/graphql/execution/execute.js:67:3)
    at Object.execute (/Users/pubudu/Projects/nest-prisma-sample/node_modules/graphql/execution/execute.js:62:229)
    at Object.generateSchemaHash (/Users/pubudu/Projects/nest-prisma-sample/node_modules/apollo-server-core/src/utils/schemaHash.ts:11:18)
    at new ApolloServerBase (/Users/pubudu/Projects/nest-prisma-sample/node_modules/apollo-server-core/src/ApolloServer.ts:299:23)
    at new ApolloServer (/Users/pubudu/Projects/nest-prisma-sample/node_modules/apollo-server-express/src/ApolloServer.ts:70:1)
    at GraphQLModule.<anonymous> (/Users/pubudu/Projects/nest-prisma-sample/node_modules/@nestjs/graphql/dist/graphql.module.js:118:33)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/pubudu/Projects/nest-prisma-sample/node_modules/@nestjs/graphql/dist/graphql.module.js:16:58)
(node:50392) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:50392) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Вот пример кода: https://github.com/THPubs/nest-prisma-sample

Есть идеи, что происходит?


person THpubs    schedule 24.12.2018    source источник


Ответы (1)


Проблема связана с GraphQLOptions. Там, согласно примерам, я определил typePaths следующим образом:

typePaths: ['./**/*.graphql'],

Похоже, это получает все файлы graphql в проекте даже из папки node_modules. Итак, чтобы импортировать именно тот файл, который мне нужен, я использовал следующее:

typePaths: ['./src/prisma/prisma-types.graphql'],
person THpubs    schedule 25.12.2018