From 017726e85aa251cd0533abdf199c701568228a7a Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Tue, 11 Aug 2026 10:16:19 +0100 Subject: [PATCH] fix(sites): keep stored buildRuntime when update omits it Sites Update wrote the buildRuntime param unconditionally, so any partial update that omitted it wiped the site's runtime to an empty string. Every subsequent deployment upload then failed with 'Runtime "" is not supported' as a 500 general_unknown, since the build spec now resolves the runtime synchronously during the upload request. Functions Update already falls back to the stored runtime; do the same for sites, and surface an unresolvable runtime as the typed FUNCTION_RUNTIME_UNSUPPORTED error instead of a bare exception. Co-Authored-By: Claude Fable 5 --- src/Appwrite/Deployment/Deployments.php | 3 ++- src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Deployment/Deployments.php b/src/Appwrite/Deployment/Deployments.php index 4d234fe153..87ca7d46cd 100644 --- a/src/Appwrite/Deployment/Deployments.php +++ b/src/Appwrite/Deployment/Deployments.php @@ -3,6 +3,7 @@ namespace Appwrite\Deployment; use Ahc\Jwt\JWT; +use Appwrite\Extend\Exception; use OpenRuntimes\Orchestrator\Enum\CallbackEvent; use OpenRuntimes\Orchestrator\Enum\ReadFormat; use OpenRuntimes\Orchestrator\Jobs; @@ -506,7 +507,7 @@ readonly class Deployments $key = $resource->getAttribute($resource->getCollection() === 'sites' ? 'buildRuntime' : 'runtime'); $runtime = Config::getParam($version === 'v2' ? 'runtimes-v2' : 'runtimes', [])[$key] ?? null; if ($runtime === null) { - throw new \Exception('Runtime "' . $key . '" is not supported'); + throw new Exception(Exception::FUNCTION_RUNTIME_UNSUPPORTED, 'Runtime "' . $key . '" is not supported'); } return $runtime; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php index a009e7c0ed..89e9f66410 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php @@ -195,6 +195,10 @@ class Update extends Base $framework = $site->getAttribute('framework'); } + if (empty($buildRuntime)) { + $buildRuntime = $site->getAttribute('buildRuntime'); + } + $buildSpecification ??= $site->getAttribute('buildSpecification', APP_SITES_BUILD_SPECIFICATION_DEFAULT); $repositoryId = $site->getAttribute('repositoryId', '');