diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 3657383996..a36dfe1e4c 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -1753,6 +1753,9 @@ App::post('/v1/functions/:functionId/executions') Console::error($th->getMessage()); if ($th instanceof AppwriteException) { + if ($function->getAttribute('logging')) { + Authorization::skip(fn () => $dbForProject->createDocument('executions', $execution)); + } throw $th; } } finally { diff --git a/app/controllers/general.php b/app/controllers/general.php index 1a4debc1c4..7ee521336f 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -300,6 +300,9 @@ function router(App $utopia, Database $dbForConsole, callable $getProjectDB, Swo Console::error($th->getMessage()); if ($th instanceof AppwriteException) { + if ($function->getAttribute('logging')) { + Authorization::skip(fn () => $dbForProject->createDocument('executions', $execution)); + } throw $th; } } finally {