From 02f442ab05becd0faee4f6b848513eea898b2da0 Mon Sep 17 00:00:00 2001 From: Anton Voylenko Date: Tue, 3 Dec 2024 13:19:08 +0200 Subject: [PATCH] fix: valid way of lock checking --- src/sessions.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sessions.js b/src/sessions.js index 9007fd3..ce19ad8 100644 --- a/src/sessions.js +++ b/src/sessions.js @@ -128,8 +128,8 @@ const setupSession = async (sessionId) => { const client = new Client(clientOptions) if (releaseBrowserLock) { // See https://github.com/puppeteer/puppeteer/issues/4860 - const singletonLockPath = path.join(sessionFolderPath, `session-${sessionId}`, 'SingletonLock') - const singletonLockExists = await fs.promises.access(singletonLockPath).then(() => true).catch(() => false) + const singletonLockPath = path.resolve(path.join(sessionFolderPath, `session-${sessionId}`, 'SingletonLock')) + const singletonLockExists = await fs.promises.lstat(singletonLockPath).then(() => true).catch(() => false) if (singletonLockExists) { console.log('Browser lock file exists, removing ', sessionId) await fs.promises.unlink(singletonLockPath)