Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with injecting other services #25

Open
kunokdev opened this issue Jun 3, 2019 · 1 comment
Open

Issues with injecting other services #25

kunokdev opened this issue Jun 3, 2019 · 1 comment
Labels
question Further information is requested

Comments

@kunokdev
Copy link

kunokdev commented Jun 3, 2019

Hello, first of all, this is a very nice module;

I've been using scheduler service in such way:

@Injectable()
export class ScheduleService extends NestSchedule {
  constructor(
    @InjectModel("Subscription") private readonly Subscription: Model<ISubscriptionInstance>,
    @Inject("NotificationService") private readonly notificationService: NotificationService
  ) {
    super();
  }

  @Interval(config.scheduleInterval, {
    immediate: true
  })
  async intervalJob() {
    // ...
  }
}

I've been able to successfully inject models, but I am unable to inject other service, as I am getting this error:

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

Is that limitation of the lib or I am doing something wrong? I've been able to inject services in other modules just fine.

@miaowing
Copy link
Owner

miaowing commented Jun 4, 2019

Please check NotificationService constructor index[0] parameter, nest inject it fail

@miaowing miaowing added the question Further information is requested label Jun 4, 2019
Repository owner deleted a comment from issue-label-bot bot Jun 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants