From 8721e47a4a6af9151b9b7d567714898ab5eaa4e0 Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Wed, 7 Jan 2026 23:33:07 -0500 Subject: [PATCH] Add WebSocket error handling with stack traces Wrapped ws.onmessage in try-catch to capture full stack trace when errors occur during message handling. This will help identify where the 'Cannot read properties of undefined' error is coming from. Co-Authored-By: Claude Sonnet 4.5 --- public/index.html | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/public/index.html b/public/index.html index adc005a..6922209 100644 --- a/public/index.html +++ b/public/index.html @@ -2458,8 +2458,9 @@ ws = new WebSocket(`${protocol}//${window.location.host}`); ws.onmessage = (event) => { - const data = JSON.parse(event.data); - console.log('WebSocket message:', data); + try { + const data = JSON.parse(event.data); + console.log('WebSocket message:', data); // Handle specific message types if (data.type === 'command_result') { @@ -2521,9 +2522,13 @@ loadWorkflows(); } - // Generic refresh for other message types - if (!['command_result', 'workflow_result', 'worker_update', 'execution_started', 'execution_status', 'workflow_created', 'workflow_deleted'].includes(data.type)) { - refreshData(); + // Generic refresh for other message types + if (!['command_result', 'workflow_result', 'worker_update', 'execution_started', 'execution_status', 'workflow_created', 'workflow_deleted'].includes(data.type)) { + refreshData(); + } + } catch (error) { + console.error('Error handling WebSocket message:', error); + console.error('Stack trace:', error.stack); } };