Skip to content

Coding errors hidden behind failing agenda #11

@manuel-reil

Description

@manuel-reil

If you have a typo or other error while coding with the result that sails cannot lift, you get the following output to console instead of the error itself.

A hook (`controllers`) failed to load!
0|web      | TypeError: Cannot read property 'updateMany' of undefined
0|web      |     at Agenda._unlockJobs (/mypath/server/node_modules/agenda/lib/agenda.js:455:19)
0|web      |     at Agenda.stop (/mypath/server/node_modules/agenda/lib/agenda.js:394:8)
0|web      |     at Sails.stopServer (/mypath/server/node_modules/sails-hook-jobs/index.js:14:12)
0|web      |     at emitNone (events.js:91:20)
0|web      |     at Sails.emit (events.js:185:7)
0|web      |     at Sails.emitter.emit (/mypath/server/node_modules/sails/lib/app/private/after.js:50:11)
0|web      |     at /mypath/server/node_modules/sails/lib/app/lower.js:67:11
0|web      |     at beforeShutdown (/mypath/server/node_modules/sails/lib/app/lower.js:45:12)
0|web      |     at Sails.lower (/mypath/server/node_modules/sails/lib/app/lower.js:49:3)
0|web      |     at Sails.wrapper [as lower] (/mypath/server/node_modules/@sailshq/lodash/lib/index.js:3250:19)
0|web      |     at sailsReady (/mypath/server/node_modules/sails/lib/app/lift.js:41:20)
0|web      |     at /mypath/server/node_modules/sails/node_modules/async/lib/async.js:721:13
0|web      |     at /mypath/server/node_modules/sails/node_modules/async/lib/async.js:52:16
0|web      |     at /mypath/server/node_modules/sails/node_modules/async/lib/async.js:264:21
0|web      |     at /mypath/server/node_modules/sails/node_modules/async/lib/async.js:44:16
0|web      |     at /mypath/server/node_modules/sails/node_modules/async/lib/async.js:718:17
0|web      |     at /mypath/server/node_modules/sails/node_modules/async/lib/async.js:167:37
0|web      |     at /mypath/server/node_modules/sails/lib/app/load.js:173:22
0|web      |     at /mypath/server/node_modules/sails/node_modules/async/lib/async.js:52:16
0|web      |     at /mypath/server/node_modules/sails/node_modules/async/lib/async.js:565:21
0|web      |     at /mypath/server/node_modules/sails/node_modules/async/lib/async.js:167:37
0|web      |     at /mypath/server/node_modules/sails/lib/app/load.js:120:23

This is observed especially with coding errors in controllers or Models.
The message is always the same and makes it really hard to debug.

Any idea how we can let agenda survive during sails lift?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions