Hi @PitaJ
I updated the running environment to Node 10.
>>node -v
v10.11.0
Fresh install of nodebb with nodebb-plugin-calendar.
Creating a post and then deleting it brings the same issue:
error: message=The last argument must be of type Function. Received type object, stack=TypeError [ERR_INVALID_ARG_TYPE]: The last argument must be of type Function. Received type object
at Object.deleteEvent [as method] (util.js:1418:13)
at nodebb/src/plugins/hooks.js:137:12
at nodebb/node_modules/async/dist/async.js:3110:16
at eachOfArrayLike (nodebb/node_modules/async/dist/async.js:1069:9)
at eachOf (nodebb/node_modules/async/dist/async.js:1117:5)
at Object.eachLimit (nodebb/node_modules/async/dist/async.js:3172:5)
at fireActionHook (nodebb/src/plugins/hooks.js:129:9)
at Object.Plugins.fireHook (nodebb/src/plugins/hooks.js:96:4)
at nodebb/src/posts/delete.js:45:13
at nextTask (nodebb/node_modules/async/dist/async.js:5324:14)
at next (nodebb/node_modules/async/dist/async.js:5331:9)
at nodebb/node_modules/async/dist/async.js:969:16
at nodebb/node_modules/async/dist/async.js:3888:9
at nodebb/node_modules/async/dist/async.js:473:16
at iteratorCallback (nodebb/node_modules/async/dist/async.js:1064:13)
at nodebb/node_modules/async/dist/async.js:969:16, db=null
2018-10-11T12:57:17.406Z [14863] - info: [app] Shutdown (SIGTERM/SIGINT) Initialised.
Tracing the code a bit, the issue stems from index.js
const postDelete = callbackify(deleteEvent);
Somehow callbackify does not store the callback.
If I look at the old revision of the code, it used to be:
const postDelete = (pid, cb) => deleteEvent(pid).asCallback(cb);
If I use the old code above, deleteEvent does get called properly, but falls on promise issue.
Seems that deleteEvent does not have a callback in its arguments, so that may be the issue.
Any idea how to resolve?
Thank you!
JJ.