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

Server crashes trying to get user info when not logged in #73

Open
sfiquet opened this issue Jun 12, 2018 · 1 comment
Open

Server crashes trying to get user info when not logged in #73

sfiquet opened this issue Jun 12, 2018 · 1 comment

Comments

@sfiquet
Copy link

sfiquet commented Jun 12, 2018

events.js:183
      throw er; // Unhandled 'error' event
      ^

TypeError: Cannot read property '_id' of undefined
    at /Users/sylvie/Dev/Chingu/BitHelper/routes/users/users.js:57:24
    at model.Query.<anonymous> (/Users/sylvie/Dev/Chingu/BitHelper/node_modules/mongoose/lib/model.js:4056:16)
    at /Users/sylvie/Dev/Chingu/BitHelper/node_modules/kareem/index.js:273:21
    at /Users/sylvie/Dev/Chingu/BitHelper/node_modules/kareem/index.js:131:16
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)

It looks like it's accessing req.user._id without checking that req.user is defined.

@sfiquet
Copy link
Author

sfiquet commented Jun 19, 2018

Note: I fixed it in my branch

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

No branches or pull requests

1 participant