diff --git a/app/config/runtimes.php b/app/config/runtimes.php index 03be3f07fc..c24aaa109e 100644 --- a/app/config/runtimes.php +++ b/app/config/runtimes.php @@ -7,7 +7,7 @@ use Utopia\App; use Appwrite\Runtimes\Runtimes; -$runtimes = new Runtimes('v1'); +$runtimes = new Runtimes('v2'); $allowList = empty(App::getEnv('_APP_FUNCTIONS_RUNTIMES')) ? [] : \explode(',', App::getEnv('_APP_FUNCTIONS_RUNTIMES')); diff --git a/app/executor.php b/app/executor.php index cd8096adec..95ab8e1ac3 100644 --- a/app/executor.php +++ b/app/executor.php @@ -547,7 +547,7 @@ App::post('/v1/execution') $stdout = $executorResponse['stdout']; $res = $executorResponse['response']; if (is_array($res)) { - $res = json_encode($res); + $res = json_encode($res, JSON_UNESCAPED_UNICODE); } break; default: @@ -657,7 +657,7 @@ $http->on('start', function ($http) { /** * Warmup: make sure images are ready to run fast 🚀 */ - $runtimes = new Runtimes('v1'); + $runtimes = new Runtimes('v2'); $allowList = empty(App::getEnv('_APP_FUNCTIONS_RUNTIMES')) ? [] : \explode(',', App::getEnv('_APP_FUNCTIONS_RUNTIMES')); $runtimes = $runtimes->getAll(true, $allowList); foreach ($runtimes as $runtime) { diff --git a/tests/e2e/Services/Functions/FunctionsCustomClientTest.php b/tests/e2e/Services/Functions/FunctionsCustomClientTest.php index 7b535f64dc..808a4208a4 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomClientTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomClientTest.php @@ -397,6 +397,9 @@ class FunctionsCustomClientTest extends Scope $this->assertEquals($this->getUser()['$id'], $output['APPWRITE_FUNCTION_USER_ID']); $this->assertNotEmpty($output['APPWRITE_FUNCTION_JWT']); $this->assertEquals($projectId, $output['APPWRITE_FUNCTION_PROJECT_ID']); + // Client should never see logs and errors + $this->assertEmpty($execution['body']['stdout']); + $this->assertEmpty($execution['body']['stderr']); // Cleanup : Delete function $response = $this->client->call(Client::METHOD_DELETE, '/functions/' . $functionId, [ diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 1d0a42b536..76d495567c 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -866,6 +866,7 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals('', $output['APPWRITE_FUNCTION_USER_ID']); $this->assertEmpty($output['APPWRITE_FUNCTION_JWT']); $this->assertEquals($this->getProject()['$id'], $output['APPWRITE_FUNCTION_PROJECT_ID']); + $this->assertStringContainsString('Amazing Function Log', $executions['body']['stdout']); $executions = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId . '/executions', array_merge([ 'content-type' => 'application/json', @@ -893,7 +894,7 @@ class FunctionsCustomServerTest extends Scope public function testCreateCustomNodeExecution() { - $name = 'node-17.0'; + $name = 'node-18.0'; $folder = 'node'; $code = realpath(__DIR__ . '/../../../resources/functions') . "/$folder/code.tar.gz"; $this->packageCode($folder); diff --git a/tests/resources/functions/php-fn/index.php b/tests/resources/functions/php-fn/index.php index 685275a496..e3ce05829c 100644 --- a/tests/resources/functions/php-fn/index.php +++ b/tests/resources/functions/php-fn/index.php @@ -1,6 +1,8 @@ json([ 'APPWRITE_FUNCTION_ID' => $request['env']['APPWRITE_FUNCTION_ID'], 'APPWRITE_FUNCTION_NAME' => $request['env']['APPWRITE_FUNCTION_NAME'],