After adding the configuration module to better handle different environments for my application...
I get an error:
ERROR [ExceptionHandler] Nest can't resolve dependencies of the ProductRepository (?). Please make sure that the argument Sequelize at index [0] is available in the SequelizeModule context.
Potential solutions:
- Is SequelizeModule a valid NestJS module?
- If Sequelize is a provider, is it part of the current SequelizeModule?
- If Sequelize is exported from a separate @Module, is that module imported within SequelizeModule?
@Module({
imports: [ /* the Module containing Sequelize */ ]
})
Here is my app module imports:
@Module({
imports: [
SequelizeModule.forRootAsync({
imports: [ConfigModule],
name: "pros_and_contractors",
useFactory: (configService: ConfigService) => ({
dialect: "postgres",
host: configService.get<string>("database.host"),
port: configService.get<number>("database.port"),
username: configService.get<string>("database.username"),
password: configService.get<string>("database.password"),
database: configService.get<string>("database.database"),
synchronize: true, // consider changing
autoLoadModels: true, //consider changing
models: [],
}),
inject: [ConfigService],
}),
ConfigModule.forRoot({
envFilePath: ".env",
isGlobal: true,
load: [configuration],
}),
AuthModule,
UserModule,
ListingModule,
ContractorModule,
SupplierModule,
ProductModule,
],
controllers: [],
providers: [],
})
export class AppModule {}