From 11bbe3c6ddc9f981186645e54d8f9179393d7fba Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 1 Oct 2025 18:17:35 +0530 Subject: [PATCH 1/2] fix: test file --- .../functions/log-error-truncation/index.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/resources/functions/log-error-truncation/index.js b/tests/resources/functions/log-error-truncation/index.js index 7e94fa5028..35747095f5 100644 --- a/tests/resources/functions/log-error-truncation/index.js +++ b/tests/resources/functions/log-error-truncation/index.js @@ -2,8 +2,21 @@ module.exports = async(context) => { // Create a string that is 1000001 characters long (exceeds the 1000000 limit) const longString = 'z' + 'a'.repeat(1000000); - context.log(longString); - context.error(longString); + // Split the string into chunks of 8000 characters (max limit for each log and error) + const chunkSize = 8000; + const chunks = []; + + for (let i = 0; i < longString.length; i += chunkSize) { + chunks.push(longString.slice(i, i + chunkSize)); + } + + chunks.forEach((chunk, index) => { + context.log(chunk); + }); + + chunks.forEach((chunk, index) => { + context.error(chunk); + }); return context.res.json({ motto: 'Build like a team of hundreds_', From 813bc0d9b331df653c3a9f5d41fc4bb465997909 Mon Sep 17 00:00:00 2001 From: Darshan Date: Wed, 1 Oct 2025 18:25:32 +0530 Subject: [PATCH 2/2] fix: wrong audit resource. --- .../Http/Databases/Collections/Documents/Logs/XList.php | 5 +---- .../Databases/Http/Databases/Collections/Logs/XList.php | 6 +----- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Logs/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Logs/XList.php index 93c8639520..ed9378f644 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Logs/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Logs/XList.php @@ -108,10 +108,7 @@ class XList extends Action $audit = new Audit($dbForProject); $type = $this->getCollectionsEventsContext(); $context = $this->getContext(); - $resource = match ($context) { - ROWS => "database/$databaseId/grid/$type/$collectionId/$context/{$document->getId()}", - default => "database/$databaseId/$type/$collectionId/$context/{$document->getId()}", - }; + $resource = "database/$databaseId/$type/$collectionId/$context/{$document->getId()}"; $logs = $audit->getLogsByResource($resource, $queries); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Logs/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Logs/XList.php index 1309793234..fefc5ba5a0 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Logs/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Logs/XList.php @@ -104,11 +104,7 @@ class XList extends Action $audit = new Audit($dbForProject); $context = $this->getContext(); - $resource = match ($context) { - TABLES => "database/$databaseId/grid/$context/$collectionId", - default => "database/$databaseId/$context/$collectionId", - }; - + $resource = "database/$databaseId/$context/$collectionId"; $logs = $audit->getLogsByResource($resource, $queries); $output = [];