From 4fc2ad7b0b8a72cd034e2aa03944062ed8773518 Mon Sep 17 00:00:00 2001 From: Emmanuel Quentin Date: Wed, 28 Feb 2024 11:05:10 -0500 Subject: [PATCH] Add some log and be more defensive --- src/simple/Auth.ts | 2 ++ src/web-rtc-client.ts | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/simple/Auth.ts b/src/simple/Auth.ts index 185a659b..75600d91 100644 --- a/src/simple/Auth.ts +++ b/src/simple/Auth.ts @@ -372,6 +372,8 @@ class Auth { this.checkSubscription(session, +this.minSubscriptionType); } } catch (e: any) { + logger.error('on authenticated error', e); + // Destroy tokens when validation fails if (this.clientId) { await getApiClient().auth.deleteRefreshToken(this.clientId); diff --git a/src/web-rtc-client.ts b/src/web-rtc-client.ts index b3fb801c..af5fffd9 100644 --- a/src/web-rtc-client.ts +++ b/src/web-rtc-client.ts @@ -2602,7 +2602,9 @@ export default class WebRTCClient extends Emitter { if (this.sessionNetworkStats[sessionId]) { this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]); - this.sessionNetworkStats[sessionId].push(networkStats); + if (sessionId in this.sessionNetworkStats) { + this.sessionNetworkStats[sessionId].push(networkStats); + } } }