docs.nestjs.com icon indicating copy to clipboard operation
docs.nestjs.com copied to clipboard

Improve documentation for registerQueueAsync

Open clintonb opened this issue 1 year ago • 3 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current behavior

Registering a queue via registerQueueAsync does not work. The application fails to start:

[Nest] 6149  - 08/02/2023, 6:50:24 PM     LOG [NestFactory] Starting Nest application...
[Nest] 6149  - 08/02/2023, 6:50:24 PM     LOG [InstanceLoader] BullModule dependencies initialized +7ms
[Nest] 6149  - 08/02/2023, 6:50:24 PM     LOG [InstanceLoader] DiscoveryModule dependencies initialized +1ms
[Nest] 6149  - 08/02/2023, 6:50:24 PM     LOG [InstanceLoader] AppModule dependencies initialized +0ms
[Nest] 6149  - 08/02/2023, 6:50:24 PM   ERROR [ExceptionHandler] Nest can't resolve dependencies of the AudioController (?). Please make sure that the argument BullQueue_audio at index [0] is available in the AudioModule context.

Potential solutions:
- Is AudioModule a valid NestJS module?
- If BullQueue_audio is a provider, is it part of the current AudioModule?
- If BullQueue_audio is exported from a separate @Module, is that module imported within AudioModule?
  @Module({
    imports: [ /* the Module containing BullQueue_audio */ ]
  })

Error: Nest can't resolve dependencies of the AudioController (?). Please make sure that the argument BullQueue_audio at index [0] is available in the AudioModule context.

Potential solutions:
- Is AudioModule a valid NestJS module?
- If BullQueue_audio is a provider, is it part of the current AudioModule?
- If BullQueue_audio is exported from a separate @Module, is that module imported within AudioModule?
  @Module({
    imports: [ /* the Module containing BullQueue_audio */ ]
  })

    at Injector.lookupComponentInParentModules (/Users/clintonb/workspace/clintonb/nest/sample/26-queues/node_modules/@nestjs/core/injector/injector.js:248:19)
    at Injector.resolveComponentInstance (/Users/clintonb/workspace/clintonb/nest/sample/26-queues/node_modules/@nestjs/core/injector/injector.js:202:33)
    at resolveParam (/Users/clintonb/workspace/clintonb/nest/sample/26-queues/node_modules/@nestjs/core/injector/injector.js:123:38)
    at async Promise.all (index 0)
    at Injector.resolveConstructorParams (/Users/clintonb/workspace/clintonb/nest/sample/26-queues/node_modules/@nestjs/core/injector/injector.js:138:27)
    at Injector.loadInstance (/Users/clintonb/workspace/clintonb/nest/sample/26-queues/node_modules/@nestjs/core/injector/injector.js:64:13)
    at Injector.loadController (/Users/clintonb/workspace/clintonb/nest/sample/26-queues/node_modules/@nestjs/core/injector/injector.js:82:9)
    at /Users/clintonb/workspace/clintonb/nest/sample/26-queues/node_modules/@nestjs/core/injector/instance-loader.js:68:13
    at async Promise.all (index 0)
    at InstanceLoader.createInstancesOfControllers (/Users/clintonb/workspace/clintonb/nest/sample/26-queues/node_modules/@nestjs/core/injector/instance-loader.js:67:9)

Minimum reproduction code

https://github.com/clintonb/nest/tree/f1c60d26abbae6ec3027ab09e2859ec1bbaa2f07/sample/26-queues/src

Steps to reproduce

Run the reproduction repo: at https://github.com/clintonb/nest/tree/f1c60d26abbae6ec3027ab09e2859ec1bbaa2f07/sample/26-queues/src.

I replaced registerQueue with registerQueueAsync.

Expected behavior

The application should start, and the queue should be registered/usable.

Package version

10.0.1

Bull version

4.10.4

NestJS version

10.0.3

Node.js version

16.20.0

In which operating systems have you tested?

  • [X] macOS
  • [ ] Windows
  • [ ] Linux

Other

No response

clintonb avatar Aug 03 '23 01:08 clintonb