Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Cannot read property 'picture' of undefined #323

Closed
hstandeffer opened this issue Mar 13, 2021 · 2 comments · Fixed by #329
Closed

Cannot read property 'picture' of undefined #323

hstandeffer opened this issue Mar 13, 2021 · 2 comments · Fixed by #329

Comments

@hstandeffer
Copy link

hstandeffer commented Mar 13, 2021

Followed the basic steps to cloning and setting up the project and am getting the following error, simply after creating an account seemingly successfully:

TypeError: C:\Users\---\---\---\views\partials\header.pug:27
    25|           li.nav-item.dropdown(class=(title === 'Account Management') ? 'active' : undefined)

    26|             a.nav-link.dropdown-toggle(href='#', data-toggle='dropdown')

  > 27|               if user.profile.picture

    28|                 img(src=user.profile.picture, alt=(user.profile.name || user.email || user.id))

    29|               else

    30|                 img(src=user.gravatar(60), alt=(user.profile.name || user.email || user.id))


Cannot read property 'picture' of undefined
@klemensz
Copy link
Contributor

I can reproduce the same issue.

@klemensz
Copy link
Contributor

I found this in passport.ts:

passport.deserializeUser((id, done) => {
    User.findById(id, (err: NativeError, user: UserDocument) => {
        done(err, user.id);
    });
});

Should be

passport.deserializeUser((id, done) => {
    User.findById(id, (err: NativeError, user: UserDocument) => {
        done(err, user);
    });
});

instead!? (returning user instead of user.id)

peterblazejewicz added a commit to peterblazejewicz/TypeScript-Node-Starter that referenced this issue Apr 25, 2021
This fixes issue with failing pages

/cc @klemensz

Fixes microsoft#323
peterblazejewicz added a commit that referenced this issue Apr 25, 2021
This fixes issue with failing pages

/cc @klemensz

Fixes #323
brittanydrandolph pushed a commit that referenced this issue Jun 17, 2022
This fixes issue with failing pages

/cc @klemensz

Fixes #323
pull bot pushed a commit to nemoipaha/TypeScript-Node-Starter that referenced this issue Jul 2, 2022
This fixes issue with failing pages

/cc @klemensz

Fixes microsoft#323
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants