@pasib when you concatenated the object, it got stringified.
Try console.log('test', postData); 🙂
How to troubleshoot plugin loading?
After restarting of NodeBB, none of available plugins do not load anymore.
Also, Reload give such error in console:
18/4 18:32 [34370] - error: TypeError: Reduce of empty array with no initial value
at Array.reduce (native)
at async.waterfall.x (/Users/nicolas/Documents/Works/JavaScript/NodeBB/src/plugins.js:343:8)
at fn (/Users/nicolas/Documents/Works/JavaScript/NodeBB/node_modules/async/lib/async.js:641:34)
at Immediate._onImmediate (/Users/nicolas/Documents/Works/JavaScript/NodeBB/node_modules/async/lib/async.js:557:34)
at processImmediate [as _immediateCallback] (timers.js:358:17)
TypeError: Reduce of empty array with no initial value
at Array.reduce (native)
at async.waterfall.x (/Users/nicolas/Documents/Works/JavaScript/NodeBB/src/plugins.js:343:8)
at fn (/Users/nicolas/Documents/Works/JavaScript/NodeBB/node_modules/async/lib/async.js:641:34)
at Immediate._onImmediate (/Users/nicolas/Documents/Works/JavaScript/NodeBB/node_modules/async/lib/async.js:557:34)
at processImmediate [as _immediateCallback] (timers.js:358:17)
Branch: 0.6.x
Solved by just reloading everything - several times: Database, NodeBB
That error is caused by the following bit of code in src/plugins.js
paths = paths.map(function(pluginLib) {
var parent = path.dirname(pluginLib);
return cached.filter(function(libPath) {
return libPath.indexOf(parent) !== -1;
});
}).reduce(function(prev, cur) {
return prev.concat(cur);
});
If paths
is an empty array calling reduce will throw that error. We should add better checks to detect that.