Reputation: 7219
I cannot get the contextual reference of the MyOtherService
.
Following the docs, this is my code:
@Injectable()
export class MyService {
constructor(private readonly myOtherService: MyOtherService) {}
@Cron(CronExpression.EVERY_10_SECONDS)
async test() {
this.myOtherService.someMethod() //myOtherService is undefined;
}
}
Upvotes: 0
Views: 2774
Reputation: 70131
It sounds like you have a dependency using the REQUEST
scope, which cannot be instantiated during CRON as there is no request to work with. Everything must be the singleton (DEFAULT) scope.
Upvotes: 4