Отчет об ошибке
Текущее поведение
Получение ошибки при создании экземпляра PaymentProcessorModule:
Error: Nest can't resolve dependencies of the PaymentProcessor (?, PaymentsService, ProcessingService). Please make sure that the argument TransactionsService at index [0] is available in the PaymentProcessor context.
Potential solutions:
- If TransactionsService is a provider, is it part of the current PaymentProcessor?
- If TransactionsService is exported from a separate @Module, is that module imported within PaymentProcessor?
@Module({
imports: [ /* the Module containing TransactionsService */ ]
})
Однако обе службы происходят из одного и того же модуля.
Код ввода
Вот мой модуль:
@Module({
imports: [
TypeOrmModule.forFeature([ Transaction ]),
],
providers: [
PaymentProcessor,
TransactionsService,
TransactionsResolver,
],
exports: [PaymentProcessor],
})
export class PaymentProcessorModule {}
TransactionService:
@Injectable()
export class TransactionsService {
constructor(
@InjectRepository(Transaction) private transRepo: Repository<Transaction>,
) {}
//...
}
И, наконец, PaymentProcessor:
@Injectable()
export class PaymentProcessor {
constructor(
private transactions: TransactionsService,
private payments: PaymentsService,
private processor: ProcessingService,
) {}
//...
}
Ожидаемое поведение
Ожидается внедрение службы TransactionsService. К сожалению, мне не удалось воспроизвести его в образце репозитория.
Environment
Nest version: 7.4.1