I was recently trying to upgrade to NestJS 8, and when I do, Nest complains about being unable to load ModuleRef. When running on 7.x, this same code seemed to work fine. Any ideas if this is something with my solution or if the library needs upgrading to support the newest version.
Error: Nest can't resolve dependencies of the DataLoaderInterceptor (?). Please make sure that the argument ModuleRef at index [0] is available in the AppModule context.
Potential solutions:
- If ModuleRef is a provider, is it part of the current AppModule?
- If ModuleRef is exported from a separate @Module, is that module imported within AppModule?
@Module({
imports: [ /* the Module containing ModuleRef */ ]
})
at Injector.lookupComponentInParentModules (/Users/steve/Documents/GitHub/load/node_modules/@nestjs/core/injector/injector.js:193:19)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at Injector.resolveComponentInstance (/Users/steve/Documents/GitHub/load/node_modules/@nestjs/core/injector/injector.js:149:33)
at resolveParam (/Users/steve/Documents/GitHub/load/node_modules/@nestjs/core/injector/injector.js:103:38)
at async Promise.all (index 0)
at Injector.resolveConstructorParams (/Users/steve/Documents/GitHub/load/node_modules/@nestjs/core/injector/injector.js:118:27)
at Injector.loadInstance (/Users/steve/Documents/GitHub/load/node_modules/@nestjs/core/injector/injector.js:47:9)
at Injector.loadProvider (/Users/steve/Documents/GitHub/load/node_modules/@nestjs/core/injector/injector.js:69:9)
at async Promise.all (index 3)
at InstanceLoader.createInstancesOfProviders (/Users/steve/Documents/GitHub/load/node_modules/@nestjs/core/injector/instance-loader.js:44:9)
@Module({
imports: [
...
],
controllers: [],
providers: [
{
provide: APP_INTERCEPTOR,
useClass: DataLoaderInterceptor,
},
],
})
export class AppModule {}
I was recently trying to upgrade to NestJS 8, and when I do, Nest complains about being unable to load
ModuleRef. When running on 7.x, this same code seemed to work fine. Any ideas if this is something with my solution or if the library needs upgrading to support the newest version.