diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index f68c8327b7..1bf51a52b6 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -1234,7 +1234,7 @@ App::post('/v1/functions/:functionId/deployments') 'path' => '', 'runtime' => $function->getAttribute('runtime'), 'source' => $deployment->getAttribute('path', ''), - 'sourceType' => strtolower($deviceFunctions->getType()), + 'sourceType' => strtolower($deviceForFunctions->getType()), 'logs' => '', 'endTime' => null, 'duration' => 0, diff --git a/src/Appwrite/Platform/Workers/Builds.php b/src/Appwrite/Platform/Workers/Builds.php index c59dfef01a..5fcd2f2e24 100644 --- a/src/Appwrite/Platform/Workers/Builds.php +++ b/src/Appwrite/Platform/Workers/Builds.php @@ -10,6 +10,7 @@ use Appwrite\Messaging\Adapter\Realtime; use Appwrite\Utopia\Response\Model\Deployment; use Appwrite\Vcs\Comment; use Exception; +use Executor\Executor; use Swoole\Coroutine as Co; use Utopia\App; use Utopia\Cache\Cache; @@ -156,13 +157,11 @@ class Builds extends Action $startTime = DateTime::now(); $durationStart = \microtime(true); $buildId = $deployment->getAttribute('buildId', ''); - if ($buildId->isEmpty()) { + $build = $dbForProject->getDocument('builds', $buildId); + if ($build->isEmpty()) { throw new AppwriteException(AppwriteException::BUILD_NOT_FOUND); } - $deviceFunctions = $getFunctionsDevice($project->getId()); - - $build = $dbForProject->getDocument('builds', $buildId); if ($build->getAttribute('status') === 'cancelled') { return; } @@ -170,7 +169,7 @@ class Builds extends Action $isNewBuild = empty($build->getAttribute('startTime')); $build->setAttribute('status', 'processing'); $build->setAttribute('startTime', $startTime); - $build->setAttribute('sourceType', strtolower($deviceFunctions->getType())); + $build->setAttribute('sourceType', strtolower($deviceForFunctions->getType())); $build = $dbForProject->updateDocument('builds', $buildId, $build); $source = $deployment->getAttribute('path', '');