julianlam / nodebb-plugin-session-sharing

Allows login sessions from your app to persist in NodeBB
MIT License
88 stars 65 forks source link

Cannot read property 'isBanned' #82

Closed patsanch closed 4 years ago

patsanch commented 4 years ago

Hi,

I'm getting this error:

2019-09-18T23:18:27.862Z [26413] - error: message=Cannot read property 'isBanned' of undefined, stack=TypeError: Cannot read property 'isBanned' of undefined

// Error happens here
// Check ban state of user, reject if banned
user.bans.isBanned(uid, function(err, banned) {
  callback(err || banned ? new Error("banned") : null, uid);
});

// This works but of course I want to check if user is banned
// callback(null, uid);

Any idea what's causing the error?

Thanks!

julianlam commented 4 years ago

What version of NodeBB are you using? You might need to update to a newer version if isBanned is undefined...

patsanch commented 4 years ago

I was using v1.10.2. I upgraded to v1.12.x and the issue went away. Thanks for the tip!