kue-scheduler icon indicating copy to clipboard operation
kue-scheduler copied to clipboard

Cannot read property 'expiryKey' of null when removing the job

Open helxsz opened this issue 5 years ago • 2 comments

The code below creates a queue and add the job successfully, however when removing the job from the queue, i got an error saying

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'expiryKey' of null at Queue. (/root/mean2/node_modules/kue-scheduler/index.js:1327:22)

        var job = _queue2
                    .createJob('nbiot_schedule_refresh_token', {'appid':app.appid,'password':app.password})
                    .attempts(3)
                    .priority('normal').removeOnComplete(true).save();

        _queue2.every('*/300 * * * * *', job,function(err, job) {
            console.log('job  addTokenRefreshJob ',job.id);
        });
     _queue2.remove(app.job, function(err, response) {
    });

helxsz avatar Feb 03 '19 19:02 helxsz

Are you still having this issue @helxsz ? Thanks

carlosmouracorreia avatar Mar 21 '19 15:03 carlosmouracorreia

@carlosmouracorreia : I had this error because the id sent to the remove function wasn't a Number

florianchevallier avatar Apr 05 '19 15:04 florianchevallier