Skip to content

Commit

Permalink
Meteor frontends may crash when customHeartbeat is enabled
Browse files Browse the repository at this point in the history
due to an undefined access in the heartbeat`s logger.

Add optional chaining to the session props access so it won`t crash and
tune down some log levels around that area.
  • Loading branch information
prlanzarin authored and antobinary committed Mar 15, 2024
1 parent 4df5a5d commit a968c89
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bigbluebutton-html5/imports/startup/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ Meteor.startup(() => {
// Skipping heartbeat, because websocket is sending data
if (currentTime - this.ws.lastSentFrameTimestamp < 10000) {
try {
Logger.info('Skipping heartbeat, because websocket is sending data', {
Logger.debug('Skipping heartbeat, because websocket is sending data', {
currentTime,
lastSentFrameTimestamp: this.ws.lastSentFrameTimestamp,
userId: this.session.connection._meteorSession.userId,
userId: this.session?.connection?._meteorSession?.userId,
});
return;
} catch (err) {
Expand All @@ -102,7 +102,7 @@ Meteor.startup(() => {
if (supportsHeartbeats) {
this.hto_ref = setTimeout(() => {
try {
Logger.info('Heartbeat timeout', { userId: this.session.connection._meteorSession.userId, sentAt: currentTime, now: new Date().getTime() });
Logger.warn('Heartbeat timeout', { userId: this.session?.connection?._meteorSession?.userId, sentAt: currentTime, now: new Date().getTime() });
} catch (err) {
Logger.error(`Heartbeat timeout error: ${err}`);
} finally {
Expand Down

0 comments on commit a968c89

Please sign in to comment.