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

1.6.0 bug #473

@infister

Description

@infister

Every few minutes a warning appears:

(node:1902) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:1902) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
at /usr/lib/node_modules/laravel-echo-server/dist/channels/presence-channel.js:71:31
at Array.filter (<anonymous>)
at /usr/lib/node_modules/laravel-echo-server/dist/channels/presence-channel.js:71:81
(node:1902) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'socketId' of undefined

I am using presence channels.

This is what I found here in 71 line:

PresenceChannel.prototype.leave = function (socket, channel) {
        var _this = this;
        this.getMembers(channel).then(function (members) {
            members = members || [];
            var member = members.find(function (member) { return member.socketId == socket.id; });
---->   members = members.filter(function (m) { return m.socketId != member.socketId; });
            _this.db.set(channel + ':members', members);
            _this.isMember(channel, member).then(function (is_member) {
                if (!is_member) {
                    delete member.socketId;
                    _this.onLeave(channel, member);
                }
            });
        }, function (error) { return log_1.Log.error(error); });
    };

Seems like member is undefined.


There is also another warning:

(node:3009) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 10)
at /usr/lib/node_modules/laravel-echo-server/dist/channels/presence-channel.js:59:27
at PresenceChannel.onJoin (/usr/lib/node_modules/laravel-echo-server/dist/channels/presence-channel.js:85:14)
(node:3009) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'broadcast' of undefined

This is exactly this line:

PresenceChannel.prototype.onJoin = function (socket, channel, member) {
        this.io
            .sockets
            .connected[socket.id]
            .broadcast  <----
            .to(channel)
            .emit('presence:joining', channel, member);
    };

connected[socket.id] is undefined

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions