Oh, thanks a ton.
Troubleshooting Use of nodebb-plugin-leaderboard
I am trying to install the basic leaderboard plugin found here: https://github.com/NodeBB/nodebb-plugin-leaderboard
I have successfully installed it, and have the route set up so that users can navigate to the leaderboard landing page. This landing page correctly ranks all users by order of highest reputation to lowest.
However, when I click on the "Day", "Week", or "Month" options, I receive the following error in my browser console:
GET http://localhost:4567/api/leaderboard/daily?_=1472702124051 500 (Internal Server Error)
Has anyone else used this plugin or similar plugins that add new routes on top of the base route (like /leaderboard/daily on top of the base /leaderboard) that has run in to similar 500 code errors?
I understand this is a pretty general error code, so even some advice on next steps to troubleshoot would be appreciated.
What version of the plugin are you using? 1.1.0 of the plugin is compatible with master. 1.0.2 is compatible with nodebb 1.1.2.
If you see a 500 error in your browser console your server logs should probably have an error message+stack trace. Check those in your nodebb folder
Thanks for your response baris
I'm currently using version 1.0.2 of the plugin, and 1.1.2 of NodeBB, so they should be compatible.
I took a look at the error log and there is a stack trace like you mentioned:
31/8 21:00  - [31merror[39m: /api/leaderboard/daily TypeError: Cannot read property 'crumb' of undefined at Object.usersController.getUsers (/Users/michaelkehoe/bittiger/NodeBB/src/controllers/users.js:105:42) at async.waterfall.userData (/Users/michaelkehoe/bittiger/NodeBB/node_modules/nodebb-plugin-leaderboard/index.js:39:20) at fn (/Users/michaelkehoe/bittiger/NodeBB/node_modules/async/lib/async.js:746:34) at /Users/michaelkehoe/bittiger/NodeBB/node_modules/async/lib/async.js:1213:16 at /Users/michaelkehoe/bittiger/NodeBB/node_modules/async/lib/async.js:166:37 at /Users/michaelkehoe/bittiger/NodeBB/node_modules/async/lib/async.js:706:43 at /Users/michaelkehoe/bittiger/NodeBB/node_modules/async/lib/async.js:167:37 at Object.async.waterfall (/Users/michaelkehoe/bittiger/NodeBB/node_modules/async/lib/async.js:710:44) at plugin.renderLeaderboard (/Users/michaelkehoe/bittiger/NodeBB/node_modules/nodebb-plugin-leaderboard/index.js:37:8) at Layer.handle [as handle_request] (/Users/michaelkehoe/bittiger/NodeBB/node_modules/express/lib/router/layer.js:95:5) at next (/Users/michaelkehoe/bittiger/NodeBB/node_modules/express/lib/router/route.js:131:13) at /Users/michaelkehoe/bittiger/NodeBB/src/middleware/middleware.js:105:3 at /Users/michaelkehoe/bittiger/NodeBB/node_modules/async/lib/async.js:52:16 at Object.async.forEachOf.async.eachOf (/Users/michaelkehoe/bittiger/NodeBB/node_modules/async/lib/async.js:236:30) at Object.async.forEach.async.each (/Users/michaelkehoe/bittiger/NodeBB/node_modules/async/lib/async.js:209:22) at middleware.pluginHooks (/Users/michaelkehoe/bittiger/NodeBB/src/middleware/middleware.js:101:8)
I will take a deeper look myself. Let me know if you've seen similar errors before. Appreciate your help!
@Michael-Kehoe what's your NodeBB git hash?
git rev-parse HEAD
This was fixed in https://github.com/NodeBB/NodeBB/commit/a002eecd038bd8f17f3d503d5ed5e07f210d0c9c, I think it needs to be backported.
@baris I backported that change as recommended and it fixed the issue. Thanks for your help!
Just making sure I understand the plug-in correctly: the route now loads correctly, but nothing is displayed despite having users that should have a daily/weekly/monthly reputation total.
Is the next step to create my own template that references reputation totals stored in the user object? Just wondering the best way to take advantage of the routes and sorting the plugin-in provides and add a simple visualization of the reputation leaders for the day/week/month
Hmm the plugin clears the daily/weekly/monthly leaderboards on a cron so everyday the page resets. Or are you saying it shows an empty page even though a user got reputation that day?
@baris yes, currently I see a blank page when I follow any of the daily/monthly/weekly links, even though the route loads succesfully. Is there supposed to be some display of the top posters/reputation there from the default install of the leaderboard plugin?
When I look at the regular "members" section (that comes with the default implementation) from the top ribbon, I can see the accumulate total posts total, and reputation total by member. So I know my NodeBB instance should have some posts/reputation leaders
When you upvote someone they should appear in the daily/weekly/monthly leaderboards immediately. If not there is probably something wrong.
@baris Ok thanks, I will take a closer look.
Could you show me a quick screenshot of what it looks like when the leaderboard succesfully loads? And where would I find the template file in the leaderboard plugin/greater nodeBB app for what should be loading the html for the leaderboard?