diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 5937acb1b..47cae1cec 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -367,7 +367,7 @@ App::patch('/v1/functions/:functionId/deployment') $function = $dbForProject->getDocument('functions', $functionId); $deployment = $dbForProject->getDocument('deployments', $deployment); - $build = $dbForProject->getDocument('builds', $deployment->getAttribute('buildId')); + $build = $dbForProject->getDocument('builds', $deployment->getAttribute('buildId', '')); if ($function->isEmpty()) { throw new Exception('Function not found', 404); @@ -924,8 +924,8 @@ App::post('/v1/functions/:functionId/executions') \curl_close($ch); $response - ->setStatusCode(Response::STATUS_CODE_CREATED) - ->dynamic(new Document(json_decode($responseExecute, true)), Response::MODEL_SYNC_EXECUTION); + ->setStatusCode(Response::STATUS_CODE_CREATED) + ->dynamic(new Document(json_decode($responseExecute, true)), Response::MODEL_SYNC_EXECUTION); }); App::get('/v1/functions/:functionId/executions') diff --git a/app/executor.php b/app/executor.php index 94860f433..b91304d00 100644 --- a/app/executor.php +++ b/app/executor.php @@ -930,15 +930,10 @@ App::post('/v1/functions/:functionId/executions') ->inject('dbForProject') ->action( function (string $trigger, string $projectId, string $executionId, string $functionId, string $event, string $eventData, string $data, array $webhooks, string $userId, string $jwt, Response $response, Database $dbForProject) { - try { - $data = execute($trigger, $projectId, $executionId, $functionId, $dbForProject, $event, $eventData, $data, $webhooks, $userId, $jwt); - $response - ->setStatusCode(Response::STATUS_CODE_OK) - ->json($data); - } catch (Exception $e) { - logError($e, 'executeEndpoint'); - throw $e; - } + $data = execute($trigger, $projectId, $executionId, $functionId, $dbForProject, $event, $eventData, $data, $webhooks, $userId, $jwt); + $response + ->setStatusCode(Response::STATUS_CODE_OK) + ->json($data); } ); diff --git a/app/workers/builds.php b/app/workers/builds.php index 68c971d7b..50b2c93bf 100644 --- a/app/workers/builds.php +++ b/app/workers/builds.php @@ -151,7 +151,6 @@ class BuildsV1 extends Worker // Build the Code try { - Console::info("[ INFO ] Creating build with id: $buildId"); $deployment->setAttribute('status', 'building'); $deployment = $dbForProject->updateDocument('deployments', $deploymentId, $deployment); $this->createBuild($projectId, $functionId, $deploymentId, $buildId); diff --git a/tests/e2e/Services/Functions/FunctionsCustomClientTest.php b/tests/e2e/Services/Functions/FunctionsCustomClientTest.php index b1546e18f..a175bb48a 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomClientTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomClientTest.php @@ -242,7 +242,7 @@ class FunctionsCustomClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], [ - 'async' => 1, + 'async' => true, ]); $this->assertEquals(401, $execution['headers']['status-code']);