I've had a problem with dependencies in NestJS. On launch my NestJS app, compiler throw me this:
[Nest] 16004 - 09.04.2022, 16:14:46 ERROR [ExceptionHandler] Nest can't resolve dependencies of the AccountService (MailingService, ?). Please make sure that the argument DataSource at index [1] is available in the AccountModule context.
Can someone tell me what I'm doing wrong?
Here is my modules:
@Module({
imports: [],
providers: [AccountService, MailingService],
controllers: [AccountController],
exports: []
})
export class AccountModule {}
@Module({
imports: [
TypeOrmModule.forRootAsync({
useClass: TypeOrmConfigService,
}),
],
})
export class DatabaseModule {}
@Module({
imports: [
DatabaseModule,
ConfigModule.forRoot({
envFilePath: '.env',
}),
ScheduleModule.forRoot(),
AccountModule,
AuthModule,
MailingModule],
controllers: [AppController],
providers: [],
})
export class AppModule { }
thanks for any help!
PS. DataSource is a class from TypeORM to make query, earlier it was Connection class