-
Notifications
You must be signed in to change notification settings - Fork 58
Description
Describe the bug
I am encountering an UnknownExportException when trying to use NestjsQueryGraphQLModule in my LogModule. The error indicates that the module cannot export a provider/module that is not part of the currently processed module.
Have you read the Contributing Guidelines?
Yes.
To Reproduce
Steps to reproduce the behavior:
Define LogModule with NestjsQueryGraphQLModule as an import.
Attempt to start the application using the command pnpm run start:dev
Encounter the following error:
UnknownExportException [Error]: Nest cannot export a provider/module that is not a part of the currently processed module (LogModule). Please verify whether the exported NestjsQueryGraphQLModule is available in this particular context.
Expected behavior
I expected the application to start without the export error after configuring the LogModule correctly.
Screenshots
Desktop (please complete the following information):
Node Version: v20.17.0
NestJS-query Version: v9.0.2
Additional context
The error occurs even though NestjsQueryGraphQLModule is imported within LogModule. I have ensured that the relevant providers and modules are correctly imported and exported. Here is the relevant code snippet for LogModule:
import { Module, forwardRef } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import { NestjsQueryGraphQLModule } from '@ptc-org/nestjs-query-graphql';
import { NestjsQueryTypeOrmModule } from '@ptc-org/nestjs-query-typeorm';
import { ContactModule } from 'src/modules/core/contact/contact.module';
import { CategoryModule } from 'src/modules/support/category/category.module';
import { WorkItemModule } from 'src/modules/support/workitem/workitem.module';
import { JwtAuthGuard } from '../../../common/modules/auth/guards/jwt-auth.guard';
import { LogDto } from './log.dto';
import { Log } from './log.entity';
import { LogResolver } from './log.resolver';
import { LogService } from './log.service';
@module({
imports: [
ConfigModule,
forwardRef(() =>
NestjsQueryGraphQLModule.forFeature({
imports: [
NestjsQueryTypeOrmModule.forFeature([Log]),
WorkItemModule,
ContactModule,
CategoryModule,
],
services: [LogService],
resolvers: [
{
DTOClass: LogDto,
EntityClass: Log,
guards: [JwtAuthGuard],
enableAggregate: true,
enableTotalCount: true,
enableSubscriptions: true,
},
],
}),
),
],
providers: [LogService, LogResolver],
exports: [NestjsQueryGraphQLModule, LogService],
})
export class LogModule {}
When I remove NestjsQueryGraphQLModule and all related modules, I start getting errors related to other services, for example:
[LOGGER] 2025-02-26 16:08:08 error : UnknownDependenciesException [Error]: Nest can't resolve dependencies of the PriorityMatrixService (?, ContactService, ImpactService, UrgencyService, WorkItemService). Please make sure that the argument "PriorityMatrixRepository" at index [0] is available in the PriorityMatrixModule context.
Potential solutions:
- Is PriorityMatrixModule a valid NestJS module?
- If "PriorityMatrixRepository" is a provider, is it part of the current PriorityMatrixModule?
- If "PriorityMatrixRepository" is exported from a separate @module, is that module imported within PriorityMatrixModule?
@module({
imports: [ /* the Module containing "PriorityMatrixRepository" */ ]
})
Even if I add the services to the exports, it still returns an error regarding the "XXXXRepository." It's strange because the code works correctly with NestJS 10. Do you have any recommendations?
