From 492ff10ee7b8d3e7022387702587e0b3a1459d6e Mon Sep 17 00:00:00 2001 From: Mayank Agarwal Date: Mon, 19 May 2025 20:52:49 +0530 Subject: [PATCH] Add async=false solution --- .../Modules/Functions/Http/Executions/Create.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php index ef31d5a79c..0cebb986e2 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php @@ -423,12 +423,21 @@ class Create extends Base } } + $maxLogLength = 100000; + $logs = $executionResponse['logs'] ?? ''; + $logsTruncated = false; + + if (\is_string($logs) && \strlen($logs) > $maxLogLength) { + $logs = \substr($logs, 0, $maxLogLength) . "\n[WARNING] Logs truncated. The output exceeded {$maxLogLength} characters."; + $logsTruncated = true; + } + /** Update execution status */ $status = $executionResponse['statusCode'] >= 500 ? 'failed' : 'completed'; $execution->setAttribute('status', $status); $execution->setAttribute('responseStatusCode', $executionResponse['statusCode']); $execution->setAttribute('responseHeaders', $headersFiltered); - $execution->setAttribute('logs', $executionResponse['logs']); + $execution->setAttribute('logs', $logs); $execution->setAttribute('errors', $executionResponse['errors']); $execution->setAttribute('duration', $executionResponse['duration']); } catch (\Throwable $th) {