From 0fcca307cdc8f8c295555f4914156ddbb9bbfe96 Mon Sep 17 00:00:00 2001 From: Anton Voylenko Date: Mon, 14 Oct 2024 13:03:45 +0300 Subject: [PATCH] fix: check if pupPage available --- src/sessions.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sessions.js b/src/sessions.js index 45fccf5f..03277adb 100644 --- a/src/sessions.js +++ b/src/sessions.js @@ -387,8 +387,8 @@ const reloadSession = async (sessionId) => { if (!client) { return } - client.pupPage.removeAllListeners('close') - client.pupPage.removeAllListeners('error') + client.pupPage?.removeAllListeners('close') + client.pupPage?.removeAllListeners('error') try { const pages = await client.pupBrowser.pages() await Promise.all(pages.map((page) => page.close())) @@ -416,8 +416,8 @@ const deleteSession = async (sessionId, validation) => { if (!client) { return } - client.pupPage.removeAllListeners('close') - client.pupPage.removeAllListeners('error') + client.pupPage?.removeAllListeners('close') + client.pupPage?.removeAllListeners('error') if (validation.success) { // Client Connected, request logout console.log(`Logging out session ${sessionId}`)