diff --git a/app/config/variables.php b/app/config/variables.php index b986ce4247..eced52d80a 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -711,13 +711,22 @@ return [ 'variables' => [ [ 'name' => '_APP_FUNCTIONS_SIZE_LIMIT', - 'description' => 'The maximum size deployment in bytes. The default value is 30MB.', + 'description' => 'The maximum size of a function in bytes. The default value is 30MB.', 'introduction' => '0.13.0', 'default' => '30000000', 'required' => false, 'question' => '', 'filter' => '' ], + [ + 'name' => '_APP_FUNCTIONS_BUILD_SIZE_LIMIT', + 'description' => 'The maximum size of a built deployment in bytes. The default value is 2,000,000,000 (2GB), and the maximum value is 4,294,967,295 (4.2GB).', + 'introduction' => '1.6.0', + 'default' => '2000000000', + 'required' => false, + 'question' => '', + 'filter' => '' + ], [ 'name' => '_APP_FUNCTIONS_TIMEOUT', 'description' => 'The maximum number of seconds allowed as a timeout value when creating a new function. The default value is 900 seconds. This is the global limit, timeout for individual functions are configured in the function\'s settings or in appwrite.json.', diff --git a/src/Appwrite/Platform/Workers/Builds.php b/src/Appwrite/Platform/Workers/Builds.php index d026a9e54b..d0fb597258 100644 --- a/src/Appwrite/Platform/Workers/Builds.php +++ b/src/Appwrite/Platform/Workers/Builds.php @@ -493,6 +493,11 @@ class Builds extends Action $endTime = DateTime::now(); $durationEnd = \microtime(true); + $buildSizeLimit = (int) System::getEnv('_APP_FUNCTIONS_BUILD_SIZE_LIMIT', '2000000000'); + if ($response['size'] > $buildSizeLimit) { + throw new \Exception('Build size should be less than ' . number_format($buildSizeLimit / 1048576, 2) . ' MBs.'); + } + /** Update the build document */ $build->setAttribute('startTime', DateTime::format((new \DateTime())->setTimestamp(floor($response['startTime'])))); $build->setAttribute('endTime', $endTime);