Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot set property 'user' of undefined on login page #3489

Closed
maissani opened this issue Aug 25, 2015 · 22 comments
Closed

Cannot set property 'user' of undefined on login page #3489

maissani opened this issue Aug 25, 2015 · 22 comments

Comments

@maissani
Copy link

After upgrade when someone try to login into nodebb.
If the user and password match node bb will display :
Cannot set property 'user' of undefined
Tried it with a couple of themes including the default one.
This break the login feature.

Cordialy,
Mehdi Aissani

@maissani
Copy link
Author

This may en issue with passport 0.2.1 to 0.3.0 upgrade.
Some lines of code may have to be updated because of passport changes.

There is also an issue with async@'^0.9.0' since update ( WARN on NPM ) but i don't think this is the origin of the issue. Try to watch diff from passport 0.2.1 to 0.3.0

Best Regards

@maissani
Copy link
Author

Please look at this:
If this is not relevant to this issue please ignore:
jaredhanson/passport@66fb128#diff-04c6e90faac2675aa89e2176d2eec7d8

Cordially

@julianlam
Copy link
Member

Mehdi, please show us the entire stack trace, as the error itself does not tell us where the problem originates.

@julianlam
Copy link
Member

Also report your commit hash (git rev-parse HEAD) so we can attempt to reproduce.

@maissani
Copy link
Author

Commit Hash : 7210ffd
Wait a minute there is no trace in logs, i ll try to obtain the trace of the error displayed in the error flash message.
I ll update this issue quickly. Need 20 min max.

best regards

@maissani
Copy link
Author

There is no errors in log file.
This show an error for the user but no error are output in logs , including launching nodebb via node app dev that generaly output most of errors.

@maissani
Copy link
Author

Fixed strangely by thoses lines of code:

// remove all node_modules
rm -rf node_modules/
// re-install dependencies
npm install
// install redis and redis-server (There is no needs to execute i think, but i have done it )
npm install redis
npm install connect-redis

Lines of code:
Found @ https://community.nodebb.org/topic/6298/nodebb-v0-7-3/19

Related about nodebb upgrade command that sometimes doesn't do the job correctly after pulling and launching upgrade commande.

You can close this issue, i think.

@julianlam
Copy link
Member

good good, thanks for confirming that it is resolved!

@maissani
Copy link
Author

Thanks @julianlam

@ghost
Copy link

ghost commented Aug 26, 2015

@julianlam I'm currently encountering this problem on the NodeBB community. Cannot login thought.
The POST to /login returns 403 with content "Cannot set property 'user' of undefined"

@ghost
Copy link

ghost commented Aug 26, 2015

Due to the impact of this (and the assumption that 403 response-code prevents it from being noticed by you guys yet) I'll additionally ping @barisusakli and @psychobunny 😉

@maissani
Copy link
Author

@frissdiegurke Have you try to execute the lines of codes previously pasted in this issue that fix this bug to my environement.

Try this @the root of your nodebb ( where the folder node_modules is):
// remove all node_modules
rm -rf node_modules/
// re-install dependencies
npm install
// install redis and redis-server (There is no needs to execute i think, but i have done it )
npm install redis
npm install connect-redis

Best Regards,
Mehdi Aissani

Ps: if you can't fix this issue with it please paste your commit hash and stack trace of your error.
If you can't get logs about it like me, please try to start the app with : ./node app dev

@julianlam If @frissdiegurke fix it with those commands, can you add to the wiki the solve that i have providen as a known issue that could be fixed by clearing and re-install node modules.

@ghost
Copy link

ghost commented Aug 26, 2015

@maissani A bit of misunderstanding here: I'm trying to login into https://community.nodebb.org and that fails.

So it's up to @julianlam @barisusakli or @psychobunny to fix their dependencies.
And since it's in their interest to get it running ASAP I've pinged them all.

@julianlam
Copy link
Member

@frissdiegurke It's odd as I cannot reproduce this on the community forum. Logged out and logged back in with no issues.

@ghost
Copy link

ghost commented Aug 26, 2015

weird. I just tried with another browser and my second account, but both failed with the issue.
A password-reset didn't change anything either (password-change worked, not to confuse here :D).
I'll just send you my second account's data to test out.

@julianlam
Copy link
Member

@frissdiegurke No need, reproduced in incognito, oddly.

@julianlam
Copy link
Member

jaredhanson/passport#400

@julianlam
Copy link
Member

In the meantime, I overrode the forum's package.json to use passport ^0.2.2, ran npm i, and login works again.

A workaround until we can properly resolve the issue.

@julianlam
Copy link
Member

This blocks the next version of NodeBB from launching.

@julianlam
Copy link
Member

This is no longer blocking NodeBB launch. Installs with the 2factor plugin will run into issues as it depends on an old version of passport, so that's waiting on jaredhanson/passport-totp#5 to be merged.

@julianlam julianlam added this to the 0.8.0 milestone Aug 27, 2015
@julianlam julianlam self-assigned this Aug 27, 2015
@julianlam
Copy link
Member

Fixed in NodeBB/nodebb-plugin-2factor@ed5b02f

@olivierlambert
Copy link

Same issue for me, the (sadly usual with npm, ie removing node_modules) procedure did the trick.

We are also developing a node app, and encountering the same general problems with npm. Happy to see we are not alone ;) Keep up the good work on NodeBB!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants