Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nest can't resolve dependencies of the ApolloDriver. #3117

Closed
2 of 4 tasks
patrickacioli opened this issue Feb 2, 2024 · 2 comments
Closed
2 of 4 tasks

Nest can't resolve dependencies of the ApolloDriver. #3117

patrickacioli opened this issue Feb 2, 2024 · 2 comments

Comments

@patrickacioli
Copy link

patrickacioli commented Feb 2, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

Application with non-deterministic behavior with Apollo Driver.

Minimum reproduction code

https://gist.github.com/patrickacioli/33b24e736239dbade8adcf37982cf290

Steps to reproduce

yarn 
yarn nest start --watch

Expected behavior

Application should start without any errors from internal nestjs modules

Package version

^12.0.11

Graphql version

graphql: ^16.8.1
apollo-server-express: ^3.13.0

NestJS version

^10.3.1

Node.js version

v18.18.0

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

[9:06:05 PM] Found 0 errors. Watching for file changes.

[Nest] 37820  - 02/01/2024, 9:06:06 PM     LOG [NestFactory] Starting Nest application...
[Nest] 37820  - 02/01/2024, 9:06:06 PM     LOG [InstanceLoader] AppModule dependencies initialized +7ms
[Nest] 37820  - 02/01/2024, 9:06:06 PM   ERROR [ExceptionHandler] Nest can't resolve dependencies of the ApolloDriver. Please make sure that the "graphQlFactory" property is available in the current context.

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

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

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

    at Injector.lookupComponentInParentModules (/Volumes/SSD_ACIOLI/docs/work/jrcia/insight-led/node_modules/@nestjs/core/injector/injector.js:254:19)
    at Injector.resolveComponentInstance (/Volumes/SSD_ACIOLI/docs/work/jrcia/insight-led/node_modules/@nestjs/core/injector/injector.js:207:33)
    at /Volumes/SSD_ACIOLI/docs/work/jrcia/insight-led/node_modules/@nestjs/core/injector/injector.js:313:38
    at async Promise.all (index 2)
    at Injector.resolveProperties (/Volumes/SSD_ACIOLI/docs/work/jrcia/insight-led/node_modules/@nestjs/core/injector/injector.js:304:27)
    at callback (/Volumes/SSD_ACIOLI/docs/work/jrcia/insight-led/node_modules/@nestjs/core/injector/injector.js:64:36)
    at Injector.resolveConstructorParams (/Volumes/SSD_ACIOLI/docs/work/jrcia/insight-led/node_modules/@nestjs/core/injector/injector.js:144:24)
    at Injector.loadInstance (/Volumes/SSD_ACIOLI/docs/work/jrcia/insight-led/node_modules/@nestjs/core/injector/injector.js:70:13)
    at Injector.loadProvider (/Volumes/SSD_ACIOLI/docs/work/jrcia/insight-led/node_modules/@nestjs/core/injector/injector.js:97:9)
    at /Volumes/SSD_ACIOLI/docs/work/jrcia/insight-led/node_modules/@nestjs/core/injector/instance-loader.js:56:13
@patrickacioli
Copy link
Author

it's seems some problems with yarn workspaces, this issue can be solved by

  "workspaces": {
    "packages": [
      "packages/*",
      "apps/*"
    ],
    "nohoist": [
      "**/@angular",
      "**/@angular/**",
      "**/@nestjs",
      "**/@nestjs/**"
    ]
  }

@kamilmysliwiec
Copy link
Member

Thank you for taking the time to submit your report! From the looks of it, this could be better discussed on our Discord. If you haven't already, please join here and send a new post in the #⁠ 🐈 nestjs-help forum. Make sure to include a link to this issue, so you don't need to write it all again. We have a large community of helpful members, who will assist you in getting this to work.

@nestjs nestjs locked and limited conversation to collaborators Feb 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants