diff --git a/packages/frontend/src/components/projects/project/deployments/DeploymentDetailsCard.tsx b/packages/frontend/src/components/projects/project/deployments/DeploymentDetailsCard.tsx index ea5a33a1..b8abe55b 100644 --- a/packages/frontend/src/components/projects/project/deployments/DeploymentDetailsCard.tsx +++ b/packages/frontend/src/components/projects/project/deployments/DeploymentDetailsCard.tsx @@ -68,7 +68,9 @@ const DeploymentDetailsCard = ({ prodBranchDomains, }: DeployDetailsCardProps) => { const [openDialog, setOpenDialog] = useState(false); - const [deploymentLogs, setDeploymentLogs] = useState(); + const [deploymentLogs, setDeploymentLogs] = useState( + 'No deployment logs available', + ); const handleOpenDialog = () => setOpenDialog(true); const handleCloseDialog = () => setOpenDialog(false); @@ -92,9 +94,11 @@ const DeploymentDetailsCard = ({ const fetchDeploymentLogs = useCallback(async () => { let url = `${deployment.deployer.deployerApiUrl}/log/${deployment.applicationDeploymentRequestId}`; const res = await fetch(url, { cache: 'no-store' }); - const logs = await res.text(); - setDeploymentLogs(logs); handleOpenDialog(); + if (res.ok) { + const logs = await res.text(); + setDeploymentLogs(logs); + } }, [ deployment.deployer.deployerApiUrl, deployment.applicationDeploymentRequestId,