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

Fixes Cannot read property 'socketId' of undefined #535

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

Conversation

dkulyk
Copy link

@dkulyk dkulyk commented Jul 28, 2020

This PR adds check for member and reduce loops find + filter => only filter

On highload projects sometimes I catch:

(node:5114) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'socketId' of undefined
    at /usr/lib64/node_modules/laravel-echo-server/dist/channels/presence-channel.js:74:81
    at Array.filter (<anonymous>)
    at /usr/lib64/node_modules/laravel-echo-server/dist/channels/presence-channel.js:74:31
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

a member is not present on a channel.

@devzom
Copy link

devzom commented Dec 22, 2021

Bump , any solution?

@cmcfadden
Copy link

bump, would love to see this merged, we encountered this today.

@ulc-brian
Copy link
Contributor

ulc-brian commented Jan 31, 2022

We are also having this problem now, the error looks very close to the above and thinking this might fix it. It is basically causing the Laravel Echo server to crash about once a minute where supervisor then restarts it. Here is the stack trace we are getting:

/usr/local/lib/node_modules/laravel-echo-server/dist/channels/presence-channel.js:75
            members = members.filter(function (m) { return m.socketId != member.socketId; });
                                                                                ^

TypeError: Cannot read properties of undefined (reading 'socketId')
    at /usr/local/lib/node_modules/laravel-echo-server/dist/channels/presence-channel.js:75:81
    at Array.filter (<anonymous>)
    at /usr/local/lib/node_modules/laravel-echo-server/dist/channels/presence-channel.js:75:31
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

We are currently using Laravel Echo Server 1.6.2

@cmcfadden
Copy link

cmcfadden commented Jan 31, 2022

@ulc-brian if it's helpful, we have a fixed branch we're using at http://github.com/umn-latis/laravel-echo-server, in npm as @umn-latis/laravel-echo-server. We're doing thousands of concurrent connects on it without crashes (knock on wood).

@ulc-brian
Copy link
Contributor

Awesome, thanks for that @cmcfadden, I will likely have to do that until this is merged.

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 this pull request may close these issues.

None yet

4 participants