From d657cc1b1a5879c36ed78d6e9f40dc3dd3688b6f Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Wed, 15 Jul 2026 13:27:39 +0530 Subject: [PATCH] (fix): preserve runtime specification on function update when omitted Updating a function's schedule (or any other field) via PUT /v1/functions/:id without also sending runtimeSpecification silently overwrote it with a computed default, resetting CPU/RAM to the plan's lowest tier and forcing an unwanted cold start. runtimeSpecification now falls back to the existing value when omitted, matching how buildSpecification already behaves. --- .../Platform/Modules/Functions/Http/Functions/Update.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php index d818508713..528a811cda 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php @@ -99,12 +99,12 @@ class Update extends Base System::getEnv('_APP_COMPUTE_MEMORY', 0), 'buildSpecifications' )), 'Build specification for the function deployments.', true, ['plan']) - ->param('runtimeSpecification', fn (array $plan) => $this->getDefaultSpecification($plan), fn (array $plan) => new Specification( + ->param('runtimeSpecification', null, fn (array $plan) => new Nullable(new Specification( $plan, Config::getParam('specifications', []), System::getEnv('_APP_COMPUTE_CPUS', 0), System::getEnv('_APP_COMPUTE_MEMORY', 0) - ), 'Runtime specification for the function executions.', true, ['plan']) + )), 'Runtime specification for the function executions.', true, ['plan']) ->param('deploymentRetention', 0, new Range(0, APP_COMPUTE_DEPLOYMENT_MAX_RETENTION), 'Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept.', true) ->inject('request') ->inject('response') @@ -142,7 +142,7 @@ class Update extends Base ?array $providerBranches, ?array $providerPaths, ?string $buildSpecification, - string $runtimeSpecification, + ?string $runtimeSpecification, int $deploymentRetention, Request $request, Response $response, @@ -179,6 +179,7 @@ class Update extends Base } $buildSpecification ??= $function->getAttribute('buildSpecification', APP_COMPUTE_SPECIFICATION_DEFAULT); + $runtimeSpecification ??= $function->getAttribute('runtimeSpecification', APP_COMPUTE_SPECIFICATION_DEFAULT); $repositoryId = $function->getAttribute('repositoryId', ''); $repositoryInternalId = $function->getAttribute('repositoryInternalId', '');