Skip to content
This repository has been archived by the owner on Mar 22, 2022. It is now read-only.

Cannot read property 'user' of undefined - lib\socket\update-entity.js:26:104 #529

Closed
jerfowler opened this issue Jun 19, 2017 · 1 comment

Comments

@jerfowler
Copy link
Contributor

Getting the following error:

error: Unhandled Rejection at: Promise Promise {
TypeError: Cannot read property 'user' of undefined
at local-path\node_modules\feathers-authentication\lib\socket\update-entity.js:26:104
at Array.forEach (native)
at Object.updateEntity (local-path\node_modules\feathers-authentication\lib\socket\update-entity.js:24:26)

Looks to be an issue when assigning socketEntity:

feathers-authentication/src/socket/update-entity.js

Object.keys(socketMap).forEach(socketId => {
    const socket = socketMap[socketId];
    const socketEntity = (socket.feathers && socket.feathers[authConfig.entity]) || socket.request.feathers[authConfig.entity];
\\...

I would change that to:

Object.keys(socketMap).forEach(socketId => {
    const socket = socketMap[socketId];
    const feathers = socket.feathers || socket.request.feathers;
    const socketEntity = feathers && feathers[authConfig.entity];
\\...

I'll try and submit a pull request... if I can find the time!

@TimIsOverpowered
Copy link

TimIsOverpowered commented Jun 20, 2017

I can confirm that I get this error every patch that is sent out. Everything updates, but the error goes through.

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

No branches or pull requests

2 participants