I have a function that repeatedly uses a service of type ‘scope: Request’. This service obtains a variable from the request header and uses it for further work.
@Injectable({
scope: Scope.REQUEST
})
export class Service {
constructor(
@Inject(REQUEST) private readonly request: Request
) {}
private getXXX(){
return this.request.header('XXX').split(' ')[1];
}
}
I would like to put this function additionally in a cron job. This causes the cron job service to not build with the note ‘because it is defined in a non static provider.’
@Cron(CronExpression.EVERY_DAY_AT_MIDNIGHT)
private handleCronJobs(){}
WARN [Scheduler] Cannot register cron job "Service@handleCronJobs" because it is defined in a non static provider.
Is it possible to give the call type ‘Request’ from the cron service?