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

fix (makeen-user): make passport.deserializeUser async #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

redbmk
Copy link

@redbmk redbmk commented Nov 2, 2017

deserializeUser should not try to use
the UserRepository service without waiting for it

deserializeUser should not try to use
the UserRepository service without waiting for it
.findById(objectId(id))
.then(user => cb(null, user), cb);
passport.deserializeUser(async (req, id, cb) => {
const { UserRepository } = await req.app.modules.get('makeen.user');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for that - modules.get('some-module-name') is synchronous and it returns a map of that module's exports

@redbmk
Copy link
Author

redbmk commented Nov 2, 2017

That's odd. I was getting this error in my project that's just using the basic makeen.user and this code change fixed it:

TypeError: Cannot read property 'findById' of undefined
    at _passport2.default.deserializeUser (/path/to/packages/core/node_modules/makeen-user/build/libs/passport.js:91:54)

@viczam
Copy link
Contributor

viczam commented Nov 3, 2017

That is weird. Are you using this exact module or a modified version of it?

@redbmk
Copy link
Author

redbmk commented Nov 3, 2017

Just the vanilla module, v1.8.11

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

Successfully merging this pull request may close these issues.

2 participants