diff --git a/src/socket.io/admin/user.js b/src/socket.io/admin/user.js index e813053137..abb12cceed 100644 --- a/src/socket.io/admin/user.js +++ b/src/socket.io/admin/user.js @@ -172,7 +172,9 @@ User.exportUsersCSV = async function (socket) { setTimeout(async () => { try { await user.exportUsersCSV(); - socket.emit('event:export-users-csv'); + if (socket.emit) { + socket.emit('event:export-users-csv'); + } const notifications = require('../../notifications'); const n = await notifications.create({ bodyShort: '[[notifications:users-csv-exported]]', @@ -182,7 +184,7 @@ User.exportUsersCSV = async function (socket) { }); await notifications.push(n, [socket.uid]); } catch (err) { - winston.error(err); + winston.error(err.stack); } }, 0); }; diff --git a/src/socket.io/index.js b/src/socket.io/index.js index 4d88ed51ee..4dd74db26f 100644 --- a/src/socket.io/index.js +++ b/src/socket.io/index.js @@ -253,7 +253,7 @@ Sockets.getCountInRoom = function (room) { }; Sockets.warnDeprecated = (socket, replacement) => { - if (socket.previousEvents) { + if (socket.previousEvents && socket.emit) { socket.emit('event:deprecated_call', { eventName: socket.previousEvents[socket.previousEvents.length - 1], replacement: replacement,