diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index 0f9a9dfdf8..feba4797ab 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -763,7 +763,7 @@ class Builds extends Action $span?->set('build.runtime.error_message', $error->getMessage()); $span?->set('build.runtime.executor_error_type', $error->getType()); - $err = \in_array($error->getType(), [ExecutorException::BUILD_FAILED, ExecutorException::RUNTIME_FAILED], true) + $err = $error->getType() === ExecutorException::BUILD_FAILED ? new BuildException($error->getMessage(), previous: $error) : $error; } catch (\Throwable $error) { diff --git a/src/Executor/Exception.php b/src/Executor/Exception.php index 70499bd4c3..db40b4b745 100644 --- a/src/Executor/Exception.php +++ b/src/Executor/Exception.php @@ -6,7 +6,6 @@ class Exception extends \Exception { public const string GENERAL_UNKNOWN = 'general_unknown'; public const string BUILD_FAILED = 'build_failed'; - public const string RUNTIME_FAILED = 'runtime_failed'; public function __construct( string $message = '', diff --git a/tests/e2e/Services/Sites/SitesCustomServerTest.php b/tests/e2e/Services/Sites/SitesCustomServerTest.php index 1732f1de24..39ee71081c 100644 --- a/tests/e2e/Services/Sites/SitesCustomServerTest.php +++ b/tests/e2e/Services/Sites/SitesCustomServerTest.php @@ -2954,16 +2954,7 @@ final class SitesCustomServerTest extends Scope $this->assertEventually(function () use ($siteId, $deploymentId) { $deployment = $this->getDeployment($siteId, $deploymentId); $this->assertEquals('failed', $deployment['body']['status'], 'Deployment status does not match: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); - - $buildLogs = \preg_replace('/\x1b\[[0-9;]*m/', '', (string) $deployment['body']['buildLogs']) ?? ''; - $errorLogs = \array_values(\array_filter(\array_map( - static fn (string $line): string => \trim(\preg_replace('/^\[\d{2}:\d{2}:\d{2}\]\s+\[open-runtimes\]\s*/', '', $line) ?? ''), - \explode("\n", $buildLogs), - ), static fn (string $line): bool => \str_starts_with($line, 'Error:'))); - - $this->assertSame([ - "Error: No source code found. Ensure your source isn't empty.", - ], $errorLogs, 'Deployment logs should expose the exact user build error: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); + $this->assertStringContainsString('Error:', (string) $deployment['body']['buildLogs'], 'Deployment logs do not match: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); }, 100000, 500); $this->cleanupSite($siteId);