Hello
I'm trying to make a dynamic module using ConfigurableModuleClass but i'm getting the classic error : "Nest can't resolve dependencies of the RedisService (?). Please make sure that the argument "REDIS_MODULE_OPTIONS" at index [0] is available in the RedisModule context"
I have nearly the same as the doc : https://docs.nestjs.com/fundamentals/dynamic-modules#configurable-module-builder
redis.module-definition.ts :
export const { ConfigurableModuleClass: RedisConfigurableModuleClass, MODULE_OPTIONS_TOKEN: REDIS_MODULE_OPTIONS_TOKEN } = new ConfigurableModuleBuilder<RedisOptions['options']>({ moduleName: 'Redis' }) .setClassMethodName('forRoot').build()
redis.module.ts :
@Module({ providers: [RedisService], exports: [RedisService] }) export class RedisModule extends RedisConfigurableModuleClass {}
I instanciate the redis module in my main module like this :
RedisModule.forRootAsync({ inject: [ConfigService], useFactory: async (configService: ConfigService): Promise<RedisOptions['options']> => { return configService.getRedisOptions() } }),
And in my service I'm trying to do this :
`@Injectable()
export class RedisService {
readonly redis: ClientProxy
constructor(@Inject(REDIS_MODULE_OPTIONS_TOKEN) readonly options: RedisOptions['options']) {
console.log(options)
this.redis = ClientProxyFactory.create({
transport: Transport.REDIS,
options
})
}`
Any ideas where I missed something ?