From 09cdb063c1269ce04e9f176a299eab57aec2ac42 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Mon, 27 Jul 2026 17:00:17 +0100 Subject: [PATCH] fix(builds): fail the deployment when job submission is rejected Co-Authored-By: Claude Opus 5 (1M context) --- src/Appwrite/Deployment/Backend/Orchestrator.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Deployment/Backend/Orchestrator.php b/src/Appwrite/Deployment/Backend/Orchestrator.php index 81a5ecd442..dc071de682 100644 --- a/src/Appwrite/Deployment/Backend/Orchestrator.php +++ b/src/Appwrite/Deployment/Backend/Orchestrator.php @@ -16,6 +16,7 @@ use OpenRuntimes\Orchestrator\Model\Callback; use OpenRuntimes\Orchestrator\Model\Volume; use Utopia\Config\Config; use Utopia\Database\Database; +use Utopia\Database\DateTime; use Utopia\Database\Document; use Utopia\System\System; @@ -91,7 +92,17 @@ readonly class Orchestrator extends Backend 'buildPath' => static::buildPath($this->project->getId(), $deployment->getId()), ])); - $this->jobs->create(...static::payload($this->project, $resource, $deployment, $this->platform, $source)); + try { + $this->jobs->create(...static::payload($this->project, $resource, $deployment, $this->platform, $source)); + } catch (\Throwable $error) { + $deployment = $this->dbForProject->updateDocument('deployments', $deployment->getId(), new Document([ + 'status' => 'failed', + 'buildLogs' => "\nAn internal error occurred while building. Please try again, and contact support if the problem persists.\n", + 'buildEndedAt' => DateTime::now(), + ])); + + throw $error; + } return $deployment; }