enisdenjo / graphql-yoga-nestjs

Nest GraphQL GraphQL Yoga driver

Home Page:https://the-guild.dev/graphql/yoga-server/docs/integrations/integration-with-nestjs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GraphQL initialization fails

MitkoTschimev opened this issue · comments

Hi,

thanks for doing the work and integrating yoga into NestJS.
I tried it out with the newest version of nestjs and yoga but unfortunately it fails already at bootstrap.

codesandbox link: https://codesandbox.io/s/nestjs-yoga-graphql-auth-e68htx

sandbox@sse-sandbox-e68htx:/sandbox$ npm start

> nestjs-yoga-graphql-auth@1.0.0 start /sandbox
> nest start

[Nest] 1673  - 01/11/2023, 6:04:08 AM     LOG [NestFactory] Starting Nest application...
[Nest] 1673  - 01/11/2023, 6:04:08 AM     LOG [InstanceLoader] AppModule dependencies initialized +24ms
[Nest] 1673  - 01/11/2023, 6:04:08 AM     LOG [InstanceLoader] GraphQLModule dependencies initialized +0ms
[Nest] 1673  - 01/11/2023, 6:04:08 AM   ERROR [ExceptionHandler] Nest can't resolve dependencies of the YogaDriver. Please make sure that the "graphQlFactory" property is available in the current context.

Potential solutions:
- If GraphQLFactory is a provider, is it part of the current GraphQLModule?
- If GraphQLFactory is exported from a separate @Module, is that module imported withinGraphQLModule?
  @Module({
    imports: [ /* the Module containing GraphQLFactory */ ]
  })

Error: Nest can't resolve dependencies of the YogaDriver. Please make sure that the "graphQlFactory" property is available in the current context.

Is there something wrong with what I do?
Also I really would like to know how dependency injection with the envelop plugins are working?
My idea was to use an async initialization of the graphql module to inject the required services but therefore I have first to figure out how to start a simple server :D

I read also this issue so I thought it should work know

commented

I have the same error.

@MitkoTschimev @synerp seems like this is caused with the latest version of @nestjs/graphql@v10.1.7, downgrading to v10.1.6 fixes the issue.

Still pinpointing the exact root cause, will push a fix soon. Thanks for reporting!

Quick heads up, this has been fixed with #54. Please update to at least @graphql-yoga/nestjs@v0.3.0.