feat: use Authenticated request to pass userId

This commit is contained in:
amhsirak
2025-03-06 02:39:21 +05:30
parent e79532c9f7
commit 591318728a

View File

@@ -517,14 +517,14 @@ async function readyForRunHandler(browserId: string, id: string, userId: string)
return result.interpretationInfo; return result.interpretationInfo;
} else { } else {
logger.log('error', `Interpretation of ${id} failed`); logger.log('error', `Interpretation of ${id} failed`);
await destroyRemoteBrowser(browserId); await destroyRemoteBrowser(browserId, userId);
resetRecordingState(browserId, id); resetRecordingState(browserId, id);
return null; return null;
} }
} catch (error: any) { } catch (error: any) {
logger.error(`Error during readyForRunHandler: ${error.message}`); logger.error(`Error during readyForRunHandler: ${error.message}`);
await destroyRemoteBrowser(browserId); await destroyRemoteBrowser(browserId, userId);
return null; return null;
} }
} }
@@ -568,7 +568,7 @@ async function executeRun(id: string, userId: string) {
plainRun.status = 'running'; plainRun.status = 'running';
const browser = browserPool.getRemoteBrowser(plainRun.browserId, userId); const browser = browserPool.getRemoteBrowser(userId);
if (!browser) { if (!browser) {
throw new Error('Could not access browser'); throw new Error('Could not access browser');
} }
@@ -586,7 +586,7 @@ async function executeRun(id: string, userId: string) {
const binaryOutputService = new BinaryOutputService('maxun-run-screenshots'); const binaryOutputService = new BinaryOutputService('maxun-run-screenshots');
const uploadedBinaryOutput = await binaryOutputService.uploadAndStoreBinaryOutput(run, interpretationInfo.binaryOutput); const uploadedBinaryOutput = await binaryOutputService.uploadAndStoreBinaryOutput(run, interpretationInfo.binaryOutput);
await destroyRemoteBrowser(plainRun.browserId); await destroyRemoteBrowser(plainRun.browserId, userId);
const updatedRun = await run.update({ const updatedRun = await run.update({
...run, ...run,