registerAsync is not passing imports array
As in topic, because of this I'm not able to create an app:
QueueModule.registerAsync({
isGlobal: true,
useClass: AppQueueService,
imports: []
}),
It returns me an error:
[Nest] 26166 - 01/12/2021, 1:25:20 PM [ExceptionHandler] Nest can't resolve dependencies of the __QUEUE_OPTIONS__ (?). Please make sure that the argument AppQueueService at index [0] is available in the QueueModule context.
Potential solutions:
- If AppQueueService is a provider, is it part of the current QueueModule?
- If AppQueueService is exported from a separate @Module, is that module imported within QueueModule?
@Module({
imports: [ /* the Module containing AppQueueService */ ]
})
+0ms
Where class looks like this:
@Injectable()
export class AppQueueService implements QueueAsyncOptionsFactory {
constructor(
@Inject(awsConfig.KEY)
private readonly configAws: ConfigType<typeof awsConfig>
) {}
}
Hi @cojack, I will the check the useClass issue, shouldn't be happening. But for the time being can you try using the imports with useFactory setting and let us know if it is working fine.
I will be debugging and releasing an updated version of the package soon with the bug fix.
@vinayak25 yes, useFactory is working
QueueModule.registerAsync({
isGlobal: true,
useFactory: (configAws) => (new AppQueueService(configAws)).createQueueOptions(),
inject: [awsConfig.KEY],
imports: []
}),
Thanks for the update @cojack, request you to please go forward with the useFactory configuration only. I will be releasing a new version with the bug fix soon or please feel free to raise a PR!