From fa32133b45de7dfca5fadcada57d43e9e4b2ab4f Mon Sep 17 00:00:00 2001 From: Courtney Myers Date: Fri, 24 Jan 2025 16:13:06 -0500 Subject: [PATCH] Update verifyBapConnection() to re-establish BAP connection if error message indicates no refresh token was found in the connection --- app/server/app/utilities/bap.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/server/app/utilities/bap.js b/app/server/app/utilities/bap.js index 46517e73..d1794409 100644 --- a/app/server/app/utilities/bap.js +++ b/app/server/app/utilities/bap.js @@ -1927,13 +1927,12 @@ function verifyBapConnection(req, { name, args }) { const logMessage = `BAP Error: ${err}.`; log({ level: "error", message: logMessage, req, otherInfo: err }); - // TODO: Handle the following error: - // Error: Unable to refresh session due to: No refresh token found in the connection. + const errorMessage = err?.message || err; - if (err?.includes("No refresh token found in the connection.")) { + if (errorMessage?.includes("No refresh token found in the connection")) { log({ level: "info", message: "Re-establishing BAP connection.", req }); - // Re-establish the BAP connection. + return setupConnection(req).then(() => callback()); } throw err;