jaumard / sails-hook-schedule

Hook to manage basic cron job for sails application
21 stars 6 forks source link

Does not work with sails 0.12.3 #5

Open comm33 opened 8 years ago

comm33 commented 8 years ago

I get this when I attempt to start sails after updating to sails 0.12.3:

TypeError: sails.models.crontask.find is not a function at Hook.reloadTasks (/opt/app/node_modules/sails-hook-schedule/index.js:86:26) at Hook.wrapper as reloadTasks at /opt/app/node_modules/sails-hook-schedule/index.js:122:14 at /opt/app/node_modules/sails/lib/app/private/after.js:91:14 at /opt/app/node_modules/sails/node_modules/async/lib/async.js:721:13 at /opt/app/node_modules/sails/node_modules/async/lib/async.js:52:16 at done (/opt/app/node_modules/sails/node_modules/async/lib/async.js:246:17) at /opt/app/node_modules/sails/node_modules/async/lib/async.js:44:16 at Sails. (/opt/app/node_modules/sails/node_modules/async/lib/async.js:718:17) at Sails. (/opt/app/node_modules/sails/node_modules/async/lib/async.js:167:37) at Sails.g (events.js:260:16) at emitNone (events.js:72:20) at Sails.emit (events.js:166:7) at Sails.emitter.emit (/opt/app/node_modules/sails/lib/app/private/after.js:50:11) at /opt/app/node_modules/sails/lib/app/private/loadHooks.js:103:15 at /opt/app/node_modules/sails/node_modules/sails-hook-orm/node_modules/async/lib/async.js:52:16 at /opt/app/node_modules/sails/node_modules/sails-hook-orm/node_modules/async/lib/async.js:550:17 at /opt/app/node_modules/sails/node_modules/sails-hook-orm/node_modules/async/lib/async.js:544:17 at _arrayEach (/opt/app/node_modules/sails/node_modules/sails-hook-orm/node_modules/async/lib/async.js:85:13) at Immediate.taskComplete (/opt/app/node_modules/sails/node_modules/sails-hook-orm/node_modules/async/lib/async.js:543:13) at processImmediate as _immediateCallback

4dev commented 8 years ago

I can confirm I get the same

jaumard commented 8 years ago

If any of you know what is wrong here PR are welcome :) I'm not using sails anymore so sails repos are not my priority for now

cwmahan commented 8 years ago

it happens with v0.12.2 as well but not with v0.12.1 - if I can find some time I will try to diagnose further

jakenoble commented 8 years ago

Any ideas on how to eliminate this issue while waiting on this PR?

ipodobin commented 8 years ago

I managed to workaround this by: 1) copying file 'node_modules/sails-hook-schedule/api/models/CronTask.js' to your project's 'api/models/ directory and then 2) changing line 86 in file 'node_modules/sails-hook-schedule/index.js' from 'sails.models.crontask.find().then(function (dbTasks)' to 'CronTask.find().then(function (dbTasks)'

ermst4r commented 8 years ago

i think its a bad idea to modify your node modules folder. This solved my issue.

http://www.ermmedia.nl/how-to-create-a-cronjob-in-sails/

MatiMenich commented 8 years ago

I think it has to do with this issue with the sails-util-mvcloader module

https://github.com/leeroybrun/sails-util-mvcsloader/issues/9

jup31 commented 7 years ago

Same issue using sails 0.12.11

sgbenner commented 5 years ago

i think its a bad idea to modify your node modules folder. This solved my issue.

http://www.ermmedia.nl/how-to-create-a-cronjob-in-sails/

This also worked for me. Took about 5 minute to implement.