diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index 14d7ac15bc..a79ebfcc52 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -475,6 +475,8 @@ $image = $this->getParam('image', ''); - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 + - _APP_DOMAIN + - _APP_OPTIONS_FORCE_HTTPS - _APP_REDIS_HOST - _APP_REDIS_PORT - _APP_REDIS_USER diff --git a/src/Appwrite/Utopia/Request/Filters/V18.php b/src/Appwrite/Utopia/Request/Filters/V18.php index 8564dad47b..20241e34a7 100644 --- a/src/Appwrite/Utopia/Request/Filters/V18.php +++ b/src/Appwrite/Utopia/Request/Filters/V18.php @@ -14,7 +14,7 @@ class V18 extends Filter unset($content['otp']); break; case 'functions.create': - $content['templateVersion'] = $content['templateBranch']; + $content['templateVersion'] = $content['templateBranch'] ?? ""; unset($content['templateBranch']); break; } diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index b4d120d604..8bf1454362 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -454,8 +454,8 @@ class FunctionsCustomServerTest extends Scope $entrypoint = null; $rootDirectory = null; $commands = null; - foreach($template['body']['runtimes'] as $runtime) { - if($runtime["name"] !== $runtimeName) { + foreach ($template['body']['runtimes'] as $runtime) { + if ($runtime["name"] !== $runtimeName) { continue; } @@ -2067,6 +2067,31 @@ class FunctionsCustomServerTest extends Scope $this->assertNotEmpty($execution['body']['responseBody']); $this->assertGreaterThan(0, $execution['body']['duration']); + $execution = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/executions', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'async' => true + ]); + + $this->assertEquals(201, $execution['headers']['status-code']); + $this->assertNotEmpty(201, $execution['body']['$id']); + + \sleep(10); + + $execution = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId . '/executions/' . $execution['body']['$id'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'async' => true + ]); + + $this->assertEquals(201, $execution['headers']['status-code']); + $this->assertEquals('completed', $execution['body']['status']); + $this->assertEquals(200, $execution['body']['responseStatusCode']); + $this->assertNotEmpty($execution['body']['responseBody']); + $this->assertGreaterThan(0, $execution['body']['duration']); + // Cleanup : Delete function $response = $this->client->call(Client::METHOD_DELETE, '/functions/' . $functionId, [ 'content-type' => 'application/json', @@ -2419,4 +2444,30 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals(204, $response['headers']['status-code']); } + + public function testCreateFunctionWithResponseFormatHeader() + { + $response = $this->client->call(Client::METHOD_POST, '/functions', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-response-format' => '1.5.0', // add response format header + ], $this->getHeaders()), [ + 'functionId' => ID::unique(), + 'name' => 'Test', + 'runtime' => 'php-8.0', + 'entrypoint' => 'index.php', + 'timeout' => 15, + ]); + + $this->assertEquals(201, $response['headers']['status-code']); + + // Cleanup : Delete function + $response = $this->client->call(Client::METHOD_DELETE, '/functions/' . $response['body']['$id'], [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ], []); + + $this->assertEquals(204, $response['headers']['status-code']); + } }