From e0cb9642cddff962279905c3cb7ae156b00d01e2 Mon Sep 17 00:00:00 2001 From: F4ilji Date: Thu, 2 Jul 2026 16:55:43 +0500 Subject: [PATCH] fix: add better error logging for deploy API --- resources/js/Pages/Dashboard/Deploy/Index.vue | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/resources/js/Pages/Dashboard/Deploy/Index.vue b/resources/js/Pages/Dashboard/Deploy/Index.vue index 3658226..2d8483e 100644 --- a/resources/js/Pages/Dashboard/Deploy/Index.vue +++ b/resources/js/Pages/Dashboard/Deploy/Index.vue @@ -32,7 +32,14 @@ const fetchStatus = async () => { credentials: 'same-origin', headers, }) - status.value = await response.json() + const text = await response.text() + + try { + status.value = JSON.parse(text) + } catch { + console.error('Status response is not JSON:', text.substring(0, 200)) + return + } if (!status.value.running && pollingInterval) { clearInterval(pollingInterval) @@ -50,15 +57,24 @@ const startDeploy = async () => { credentials: 'same-origin', headers, }) - const data = await response.json() + const text = await response.text() + console.log('Deploy response:', response.status, text) + + let data + try { + data = JSON.parse(text) + } catch { + alert('Server returned HTML instead of JSON. Check console.') + return + } if (response.ok) { startPolling() } else { - alert(data.error || 'Failed to start deploy:' + data.error) + alert(data.error || 'Failed to start deploy') } } catch (error) { - alert('Failed to start deploy:' + error) + alert('Failed to start deploy: ' + error.message) } }