diff --git a/app/controllers/general.php b/app/controllers/general.php index a87304b412..d912d4770f 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -85,7 +85,11 @@ App::init(function ($utopia, $request, $response, $console, $project, $consoleDB $route = $utopia->match($request); - if (!empty($route->getLabel('sdk.auth', [])) && empty($project->getId()) && ($route->getLabel('scope', '') !== 'public')) { + if ($project->isEmpty()) { + throw new Exception('Project not found', 404); + } + + if (!empty($route->getLabel('sdk.auth', [])) && $project->isEmpty() && ($route->getLabel('scope', '') !== 'public')) { throw new Exception('Missing or unknown project ID', 400); }