From ee1ee7ecfef6e900c7c9ac488bb17e4a73ac3c46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Thu, 13 Mar 2025 10:20:45 +0100 Subject: [PATCH] Fix ping 5xx error --- app/controllers/general.php | 16 ++++++++++++++++ src/Appwrite/Utopia/Request.php | 12 ++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 81edd1445b..d8e7bc12dd 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -14,6 +14,7 @@ use Appwrite\Extend\Exception as AppwriteException; use Appwrite\Network\Validator\Origin; use Appwrite\Platform\Appwrite; use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; use Appwrite\Transformation\Adapter\Preview; use Appwrite\Transformation\Transformation; use Appwrite\Utopia\Request; @@ -1324,6 +1325,21 @@ App::get('/v1/ping') ->desc('Test the connection between the Appwrite and the SDK.') ->label('scope', 'global') ->label('event', 'projects.[projectId].ping') + ->label('sdk', new Method( + namespace: 'ping', + name: 'get', + hide: true, + description: <<inject('response') ->inject('project') ->inject('dbForPlatform') diff --git a/src/Appwrite/Utopia/Request.php b/src/Appwrite/Utopia/Request.php index 480fce58b0..01f0574357 100644 --- a/src/Appwrite/Utopia/Request.php +++ b/src/Appwrite/Utopia/Request.php @@ -36,16 +36,16 @@ class Request extends UtopiaRequest $methods = [$methods]; } + $methods = \array_filter($methods, function ($method) { + return !empty($method); + }); + $params = []; + $endpointIdentifier = 'unknown.unknown'; foreach ($methods as $method) { /** @var \Appwrite\SDK\Method $method */ - if (empty($method)) { - $endpointIdentifier = 'unknown.unknown'; - } else { - $endpointIdentifier = $method->getNamespace() . '.' . $method->getMethodName(); - } - + $endpointIdentifier = $method->getNamespace() . '.' . $method->getMethodName(); $params += $method->getParameters(); }