atls-lab / tinkoff

Tinkoff Payments Provider
https://oplata.tinkoff.ru/develop/api/payments/
BSD 3-Clause "New" or "Revised" License
2 stars 0 forks source link

[bug] request-verifier-guard cant find TinkoffService in DI container #76

Open talentumtuum opened 3 years ago

talentumtuum commented 3 years ago

Описание бага

Не разрешаются зависимости RequestVerifierGuard пакета nestjs-tinkoff

Ожидаемое поведение

Зависимости разрешаются

Материалы

Nest could not find TinkoffService element (this provider does not exist in the current context)

  15 | 
  16 |   onModuleInit() {
> 17 |     this.ref.get(TinkoffService)
     |              ^
  18 |   }
  19 | }
  20 | 

  at InstanceLinksHost.get (../../node_modules/@nestjs/testing/node_modules/@nestjs/core/injector/instance-links-host.js:24:19)
  at Object.find (../../node_modules/@nestjs/testing/node_modules/@nestjs/core/injector/module-ref.js:38:55)
  at Object.get (../../node_modules/@nestjs/testing/node_modules/@nestjs/core/injector/module.js:339:28)
  at RequestVerifierGuard.onModuleInit (src/guards/request-verifier.guard.ts:17:14)
  at MapIterator.iteratee (../../node_modules/@nestjs/testing/node_modules/@nestjs/core/hooks/on-module-init.hook.js:22:43)
  at MapIterator.next (../../node_modules/iterare/src/map.ts:9:39)
  at IteratorWithOperators.next (../../node_modules/iterare/src/iterate.ts:19:28)
      at Function.from (<anonymous>)
  at IteratorWithOperators.toArray (../../node_modules/iterare/src/iterate.ts:227:22)
  at callOperator (../../node_modules/@nestjs/testing/node_modules/@nestjs/core/hooks/on-module-init.hook.js:23:10)

Что делать?

Нужно дать guard'е контекст нашего модуля Похожая проблема решалась тут https://github.com/nestjs/passport/blob/master/lib/auth.guard.ts#L26