Open obaqueiro opened 3 years ago
Hey @obaqueiro The code you have looks right at first glance. I'll attempt to look into this one further today.
Hey @obaqueiro did you manage to solve this issue?
I had this issue for a while and what fixed it for me was by using this ConfigModule.forRoot({isGlobal: true})
instead of the one OP using.
So, I've been at it for some time and this is how I've gotten it fixed:
KafkaModule.registerAsync(['KAFKA_CLIENT'], {
imports: [ConfigModule],
useFactory: async (configService: ConfigService) => ([{
name: 'KAFKA_CLIENT',
options: {
client: {
clientId: 'some-client-id',
brokers: [configService.get('KAFKA_BROKER')]
},
consumer: {
groupId: 'some-group'
}
},
}]),
inject: [ConfigService]
})
So, because
interface KafkaModuleOptionsAsync extends Pick<ModuleMetadata, 'imports'>
you have access to an imports
object within the ModuleOptions and that's the one it will use.
This is also the way it's done in the e2e-test.
Hey there, I'm trying to use this but while attempting to use the module with RegisterAsync (version
1.4.0
) but it's blowing up. Not sure if I'm doing something wrong or if this is a bug.This is my app.module.ts:
I am injecting the
ConfigService
by usinginject
... no idea why am I getting this error.The error I'm getting: