-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed
Labels
Description
I'm submitting a...
[ ] Regression
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
Having
/* InvitationsModule
*********************** */
import { Module } from '@nestjs/common';
import { InvitationComposerService, InvitationsService } from './services';
import { DatabaseModule } from '../database';
import { AuthModule } from '../auth';
import { MailModule } from '../mail';
import { invitationModelProvider } from './providers';
@Module({
imports: [
DatabaseModule.forRoot([invitationModelProvider]),
AuthModule,
MailModule,
],
providers: [InvitationsService, InvitationComposerService],
exports: [InvitationsService],
})
export class InvitationsModule {}
/* AuthModule
*********************** */
import { Module } from '@nestjs/common';
import { ExternalAuthModule } from '../external-auth';
import { AuthService, ExternalAuthAdapterService } from './services';
import { AuthController } from './auth.controller';
import { AuthMiddleware } from './auth.middleware';
@Module({
imports: [ExternalAuthModule],
providers: [AuthService, ExternalAuthAdapterService, AuthMiddleware],
controllers: [AuthController],
exports: [AuthService],
})
export class AuthModule {}
where ExternalAuthModule
and MailModule
have no module imports,
I have this:
which leads to
Error: Nest cannot create the module instance. Often, this is because of a circular dependency between modules. Use forwardRef() to avoid it. (Read more https://docs.nestjs.com/advanced/circular-dependency.) Scope [TestModule -> InvitationsModule -> AuthModule]
Expected behavior
It should work
Minimal reproduction of the problem with instructions
Not sure. We've got nearly 50 modules and all are working fine.
And most of them actually use AuthModule
as you might guess.
Only this one, that I've created recently can't load. Any ideas on what am I doing wrong? :)
What is the motivation / use case for changing the behavior?
Environment
Nest version: 5.0.1
Actually, i've got the same is on v4
For Tooling issues:
- Node version: 10.10.0
- Platform: Mac
Others: