Bug Report
Current Issue
Encountering an error when trying to instantiate the PaymentProcessorModule:
Error: Nest cannot resolve dependencies of the PaymentProcessor (?, PaymentsService, ProcessingService). Please ensure that the TransactionsService argument at index [0] is available in the PaymentProcessor context.
Possible solutions:
- If TransactionsService is a provider, verify if it is included in the current PaymentProcessor.
- If TransactionsService is exported from a separate @Module, confirm if that module is imported within PaymentProcessor.
@Module({
imports: [ /* the Module containing TransactionsService */ ]
})
However, both services are part of the same module.
Input Code
Below is my module setup:
@Module({
imports: [
TypeOrmModule.forFeature([ Transaction ]),
],
providers: [
PaymentProcessor,
TransactionsService,
TransactionsResolver,
],
exports: [PaymentProcessor],
})
export class PaymentProcessorModule {}
TransactionsService:
@Injectable()
export class TransactionsService {
constructor(
@InjectRepository(Transaction) private transRepo: Repository<Transaction>,
) {}
//...
}
Lastly, PaymentProcessor:
@Injectable()
export class PaymentProcessor {
constructor(
private transactions: TransactionsService,
private payments: PaymentsService,
private processor: ProcessingService,
) {}
//...
}
Expected Outcome
Anticipating successful injection of TransactionsService. I was unable to replicate this issue in a sample repository, unfortunately.
Environment
Nest version: 7.4.1