diff --git a/app/workers/builds.php b/app/workers/builds.php index 2d2f66bb72..74112d587c 100644 --- a/app/workers/builds.php +++ b/app/workers/builds.php @@ -12,6 +12,7 @@ use Utopia\CLI\Console; use Utopia\Storage\Storage; use Utopia\Database\Document; use Utopia\Config\Config; +use Utopia\Database\Query; require_once __DIR__ . '/../init.php'; @@ -143,7 +144,15 @@ class BuildsV1 extends Worker ); $source = $deployment->getAttribute('path'); - $vars = $function->getAttribute('vars', []); + $vars = []; + $variables = $dbForProject->find('variables', [ + new Query('functionInternalId', Query::TYPE_EQUAL, [$function->getInternalId()]) + ], 5000); + + foreach ($variables as $variable) { + $vars[$variable['key']] = $variable['value']; + } + $baseImage = $runtime['image']; try { diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index cdcb8e8659..e915de5120 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -1007,7 +1007,6 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals('', $output['APPWRITE_FUNCTION_EVENT']); $this->assertEquals('', $output['APPWRITE_FUNCTION_EVENT_DATA']); $this->assertEquals('foobar', $output['APPWRITE_FUNCTION_DATA']); - $this->assertEquals('variable', $output['CUSTOM_VARIABLE']); $this->assertEquals('', $output['APPWRITE_FUNCTION_USER_ID']); $this->assertEmpty($output['APPWRITE_FUNCTION_JWT']); $this->assertEquals($this->getProject()['$id'], $output['APPWRITE_FUNCTION_PROJECT_ID']); @@ -1233,7 +1232,6 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals('', $output['APPWRITE_FUNCTION_EVENT']); $this->assertEquals('', $output['APPWRITE_FUNCTION_EVENT_DATA']); $this->assertEquals('foobar', $output['APPWRITE_FUNCTION_DATA']); - $this->assertEquals('variable', $output['CUSTOM_VARIABLE']); $this->assertEquals('', $output['APPWRITE_FUNCTION_USER_ID']); $this->assertEmpty($output['APPWRITE_FUNCTION_JWT']); $this->assertEquals($this->getProject()['$id'], $output['APPWRITE_FUNCTION_PROJECT_ID']); @@ -1346,7 +1344,6 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals('', $output['APPWRITE_FUNCTION_EVENT']); $this->assertEquals('', $output['APPWRITE_FUNCTION_EVENT_DATA']); $this->assertEquals('foobar', $output['APPWRITE_FUNCTION_DATA']); - $this->assertEquals('variable', $output['CUSTOM_VARIABLE']); $this->assertEquals('', $output['APPWRITE_FUNCTION_USER_ID']); $this->assertEmpty($output['APPWRITE_FUNCTION_JWT']); $this->assertEquals($this->getProject()['$id'], $output['APPWRITE_FUNCTION_PROJECT_ID']);