@baris Great hint acutally!
I traced down to the hook.js and see how things got wired up.
So it happens when I called plugins.fireHook('filter:search.render', params, callback), where callback as I posted in the first place only takes one parameter results.
So in my registered plugin function summarizeCategories, I take exactly two parameter as following:
Since I thought callback is the one I passed in!! 😱
However, in hook.js, the callback function got wrapped around another callback function and the parameter that function takes are (err, values). Inside that the function, the original callback function was called, of course with with callback(err, results) but not callback(results).
So in my registered function summarizeCategory I was passing in the result as err parameter and of course it gives me an err message. But then the falling call of original callback(err, results) still gives me the correct results information I needed in render. lol
That's was have happened. It's kind of complicated to trace the error down since so many things named similar but it was great fun and I really enjoyed how thing get beautifully wired up in NodeBB. Great job guys!👏
I wonder if there is any place that I can jot the point down so others may not fall in the same pitfall later? I saw your documentation is a bit out dated but you did mentioned it is going under a overhaul. I am looking forward to it.😆