Nest can't resolve dependencies of the TestService (?, ControlAndReportApiService). Please make sure that the argument at index [0] is available in the ControlAndReportModule context. #19
[Nest] 26184 - 01/14/2020, 3:24:49 PM [ExceptionHandler] Nest can't resolve dependencies of the TestService (ControlAndReportApiService, ?). Please make sure that the argument at index [1] is available in the ControlAndReportModule context. +2ms
Error: Nest can't resolve dependencies of the TestService (ControlAndReportApiService, ?). Please make sure that the argument at index [1] is available in the ControlAndReportModule context.
at Injector.lookupComponentInExports (D:\nestjs-prom-master\provision-alerter\node_modules@nestjs\core\injector\injector.js:183:19)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Injector.resolveComponentInstance (D:\nestjs-prom-master\provision-alerter\node_modules@nestjs\core\injector\injector.js:143:33)
at async resolveParam (D:\nestjs-prom-master\provision-alerter\node_modules@nestjs\core\injector\injector.js:96:38)
at async Promise.all (index 1)
at async Injector.resolveConstructorParams (D:\nestjs-prom-master\provision-alerter\node_modules@nestjs\core\injector\injector.js:112:27)
at async Injector.loadInstance (D:\nestjs-prom-master\provision-alerter\node_modules@nestjs\core\injector\injector.js:78:9)
at async Injector.loadProvider (D:\nestjs-prom-master\provision-alerter\node_modules@nestjs\core\injector\injector.js:35:9)
at async Promise.all (index 4)
at async InstanceLoader.createInstancesOfProviders (D:\nestjs-prom-master\provision-alerter\node_modules@nestjs\core\injector\instance-loader.js:41:9)
Current behavior
Whenever I do npm run start it gives me the above error and I am using the below code.
I followed the ReadMe instructions to used the digikare/nestjs-prom library into our project.
I added the following:
In app.module.ts :
@module({
imports: [
PromModule.forRoot({
defaultLabels: {
app: 'provision_alerter',
},
customUrl: 'order/metrics'
}),]
In test.module.ts:
@module({
imports:[
PromModule.forMetrics([
{
type: MetricType.Counter,
configuration: {
name: 'index_counter',
help: 'get count of test orders',
}
}]),
],
providers:[TestService, ControlAndReportApiService],
controllers:[TestController]
})
export class TestModule{}
[Nest] 26184 - 01/14/2020, 3:24:49 PM [ExceptionHandler] Nest can't resolve dependencies of the TestService (ControlAndReportApiService, ?). Please make sure that the argument at index [1] is available in the ControlAndReportModule context. +2ms Error: Nest can't resolve dependencies of the TestService (ControlAndReportApiService, ?). Please make sure that the argument at index [1] is available in the ControlAndReportModule context. at Injector.lookupComponentInExports (D:\nestjs-prom-master\provision-alerter\node_modules@nestjs\core\injector\injector.js:183:19) at processTicksAndRejections (internal/process/task_queues.js:93:5) at async Injector.resolveComponentInstance (D:\nestjs-prom-master\provision-alerter\node_modules@nestjs\core\injector\injector.js:143:33) at async resolveParam (D:\nestjs-prom-master\provision-alerter\node_modules@nestjs\core\injector\injector.js:96:38) at async Promise.all (index 1) at async Injector.resolveConstructorParams (D:\nestjs-prom-master\provision-alerter\node_modules@nestjs\core\injector\injector.js:112:27) at async Injector.loadInstance (D:\nestjs-prom-master\provision-alerter\node_modules@nestjs\core\injector\injector.js:78:9) at async Injector.loadProvider (D:\nestjs-prom-master\provision-alerter\node_modules@nestjs\core\injector\injector.js:35:9) at async Promise.all (index 4) at async InstanceLoader.createInstancesOfProviders (D:\nestjs-prom-master\provision-alerter\node_modules@nestjs\core\injector\instance-loader.js:41:9)
Current behavior Whenever I do npm run start it gives me the above error and I am using the below code.
I followed the ReadMe instructions to used the digikare/nestjs-prom library into our project. I added the following: In app.module.ts : @module({ imports: [ PromModule.forRoot({ defaultLabels: { app: 'provision_alerter', }, customUrl: 'order/metrics' }),]
In test.module.ts:
@module({ imports:[ PromModule.forMetrics([ { type: MetricType.Counter, configuration: { name: 'index_counter', help: 'get count of test orders', } }]), ], providers:[TestService, ControlAndReportApiService], controllers:[TestController] }) export class TestModule{}
In test.service.ts:
constructor(private readonly controlAndReportApiService: ControlAndReportApiService, @InjectCounterMetric('index_counter') private readonly _counterMetric: CounterMetric, ) { }
async findTestOrders(): Promise<Order[]> {
const testOrders: Order[] = await getTestOrders();
}
Can someone please help me with this issue and let me know in case I am missing out something here?