lykmapipo / kue-scheduler

A job scheduler utility for kue, backed by redis and built for node.js
246 stars 47 forks source link

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

Open helxsz opened 5 years ago

helxsz commented 5 years ago

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) {
    });
carlosmouracorreia commented 5 years ago

Are you still having this issue @helxsz ? Thanks

florianchevallier commented 5 years ago

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