team-supercharge / nest-amqp

Nest AMQP 1.0 module - NPM package: https://www.npmjs.com/package/@team-supercharge/nest-amqp
https://supercharge.io
MIT License
26 stars 13 forks source link

`UnknownElementException` error with Nest v8 #35

Closed tahubu closed 3 years ago

tahubu commented 3 years ago

During Nest application bootstrap, I get this error:

UnknownElementException [Error]: Nest could not find MyListener element (this provider does not exist in the current context)
  at InstanceLinksHost.get (/Users/tahubu/my-project/node_modules/@nestjs/core/injector/instance-links-host.js:16:19)
  at Object.find (/Users/tahubu/my-project/node_modules/@nestjs/core/injector/module-ref.js:38:55)
  at Object.get (/Users/tahubu/my-project/node_modules/@nestjs/core/injector/module.js:344:28)
  at QueueModule.attachListeners (/Users/tahubu/my-project/node_modules/@team-supercharge/nest-amqp/queue.module.js:126:43)
  at QueueModule.onModuleInit (/Users/tahubu/my-project/node_modules/@team-supercharge/nest-amqp/queue.module.js:103:20)
  at Object.callModuleInitHook (/Users/tahubu/my-project/node_modules/@nestjs/core/hooks/on-module-init.hook.js:51:35)
  at processTicksAndRejections (node:internal/process/task_queues:96:5)
  at NestApplication.callInitHook (/Users/tahubu/my-project/node_modules/@nestjs/core/nest-application-context.js:169:13)
  at NestApplication.init (/Users/tahubu/my-project/node_modules/@nestjs/core/nest-application.js:97:9)
  at NestApplication.listen (/Users/tahubu/my-project/node_modules/@nestjs/core/nest-application.js:156:33)

From version 8, Nest uses class reference instead of class constructor name as injection token, but @team-supercharge/nest-amqp library supports only class constructor names. Here is the commit about the modification.