nestjs / bull

Bull module for Nest framework (node.js) :cow:
https://nestjs.com
MIT License
597 stars 98 forks source link

Issue with @InjectQueue decorator when used in a class that extends another class #2142

Closed kziya closed 2 months ago

kziya commented 2 months ago

Is there an existing issue for this?

Current behavior

When using the @InjectQueue decorator in the constructor of a class that extends another class, the NestJS IoC container incorrectly injects the queue into both the decorated argument and another argument before the decorated one.

Minimum reproduction code

https://github.com/kziya/nestjs-bull-module-injection-issue

Steps to reproduce

  1. yarn
  2. npm run start:dev
  3. open the logs in the app.service.ts constructor

Expected behavior

The appRepository should be an instance of AppRepository, and testQueue should be an instance of Queue. The testQueue should be correctly injected and passed to the AppSharedService constructor.

Package version

10.1.1

Bull version

4.14.0

NestJS version

10.0.0

Node.js version

22.3.0

In which operating systems have you tested?

Other

Screenshot 2024-06-26 at 15 02 29
micalevisk commented 2 months ago

btw this is not related with @nestjs/bull but @nestjs/core

I wonder if this is a limitation rather than a bug

![image](https://github.com/nestjs/bull/assets/13461315/d465d979-3a5e-432b-b232-6bfc34f08b53) ![image](https://github.com/nestjs/bull/assets/13461315/d9683ba1-b7a4-4ec2-8103-8815a626f216) ![image](https://github.com/nestjs/bull/assets/13461315/a1eb9e68-d89f-4e71-a739-45cc951ee2d0)
kziya commented 2 months ago

I discovered that this issue only occurs when using the @Inject decorator in the constructor of the shared class. Therefore, I don't believe this is a limitation of the framework; however, I will report it to the nestjs/core team for further investigation.