title: Can't resolve dependency when try to inject a Bull Queue in NestJS
body: <p>I'm trying to implement Nodemailer with Bull/Redis to handle email-type of tasks in NestJS.</p>
  <p>I have a shared module called <code>EmailService</code> that add a job to my queue, to do this, it needs to inject the <code>Queue</code> from <code>'bull'</code>.</p>
  <blockquote>
  <p>Nest can't resolve dependencies of the EmailService (?). Please make
  sure that the argument BullQueue_mailqueue at index [0] is available
  in the SharedModule context.</p>
  </blockquote>
  <p>My structure</p>
  <pre><code>├── src
  |  ├── app.module.ts
  |  ├── config
  |  |  └── nodemailer
  |  |     ├── nodemailer.module.ts
  |  |     ├── nodemailer.service.ts
  |  └── modules
  |     ├── modules that imports the SharedModule to send emails.
  |  └── shared
  |     ├── processors
  |     |  └── email.processor.ts
  |     ├── services
  |     |  └── email
  |     ├── shared.module.ts
  </code></pre>
  <p>app.module</p>
  <pre><code>@Module({
    imports: [
      NodemailerModule,
      // Al other modules (functionalities of my application that imports the SharedModule)
    ],
  })
  export class AppModule {}
  </code></pre>
  <p>nodemailer.module</p>
  <pre><code>@Module({
    imports: [
      MailerModule.forRootAsync({
        useClass: NodemailerService,
      }),
      BullModule.registerQueueAsync({
        useClass: NodemailerService,
      }),
    ],
    exports: [NodemailerService, BullModule], // &lt;- Exports BullModule
    providers: [NodemailerService],
  })
  export class NodemailerModule {}
  </code></pre>
  <p>NodemailerService</p>
  <pre><code>@Injectable()
  export class NodemailerService implements BullOptionsFactory {
    constructor() {}
  
    createBullOptions(): Promise&lt;BullModuleOptions&gt; | BullModuleOptions {
      return {
        name: 'myqueue',
        redis: {
          host: 'localhost',
          port: 6379,
        },
      };
    }
  
  }
  </code></pre>
  <p>Now this is my EmailService that is part of SharedModule.</p>
  <pre><code>import { Injectable } from '@nestjs/common';
  import { InjectQueue } from '@nestjs/bull';
  import { Queue } from 'bull';
  
  @Injectable()
  export class EmailService {
  
    constructor(
      @InjectQueue('myqueue')
      private readonly mailQueue: Queue,
    ) {}
  
  }
  </code></pre>
  <p>SharedModule</p>
  <pre><code>@Module({
    imports: [NodemailerModule], // &lt; imports this because it has the Bull configuration as we saw above
    exports: [EmailService],
    providers: [EmailService, EmailProcessor],
  })
  export class SharedModule {}
  </code></pre>
  <p>I have tried to follow the steps on:</p>
  <ol>
  <li><a href="https://firxworx.com/blog/coding/nodejs/email-module-for-nestjs-with-bull-queue-and-the-nest-mailer/" rel="nofollow noreferrer">https://firxworx.com/blog/coding/nodejs/email-module-for-nestjs-with-bull-queue-and-the-nest-mailer/</a></li>
  <li><a href="https://stackoverflow.com/questions/62894243/implementing-bull-queue-in-typescript">Implementing Bull Queue in Typescript</a></li>
  </ol>
  <p>I cannot see why my <code>EmailService</code> cannot inject the BullQueue dependency.</p>
  <p>What I am missing here?</p>