From 24efa0de82712c0e34cc39cb2240cd9bcc63d6fc Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Wed, 30 Aug 2023 15:02:15 -0700 Subject: [PATCH 1/2] Fix router error It's possible for the route to be null (no match) which leads to an error like: ``` appwrite | [Error] Timestamp: 2023-08-30T21:39:58+00:00 appwrite | [Error] Type: Error appwrite | [Error] Message: Call to a member function label() on null appwrite | [Error] File: /usr/src/code/app/controllers/general.php appwrite | [Error] Line: 50 ``` This adds a null check to prevent the error. --- app/controllers/general.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 2552a3e10c..e3b47098b2 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -47,7 +47,7 @@ Config::setParam('cookieSamesite', Response::COOKIE_SAMESITE_NONE); function router(App $utopia, Database $dbForConsole, SwooleRequest $swooleRequest, Request $request, Response $response) { - $utopia->getRoute()->label('error', __DIR__ . '/../views/general/error.phtml'); + $utopia->getRoute()?->label('error', __DIR__ . '/../views/general/error.phtml'); $host = $request->getHostname() ?? ''; From ac0b697d521e42d189a203f16b4bb0d7abb49229 Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Wed, 30 Aug 2023 16:06:32 -0700 Subject: [PATCH 2/2] Add router fix to CHANGES.md --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 9fac7874bb..2d9af087db 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,6 +8,7 @@ - Fix VCS/migration/assistant scopes [#6071](https://github.com/appwrite/appwrite/pull/6071) - Add missing parameters required for custom email templates [#6077](https://github.com/appwrite/appwrite/pull/6077) +- Fix `Call to a member function label() on null` error when using a custom domain [#6079](https://github.com/appwrite/appwrite/pull/6079) ## Changes