From 8716497d1f339e6e366b7b47c52265b4a8a4fde7 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Sat, 18 Apr 2026 05:42:49 +1200 Subject: [PATCH] (diag): log project lookup result before getProjectDB fallback --- app/realtime.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/realtime.php b/app/realtime.php index 68629dba03..822dd8eba8 100644 --- a/app/realtime.php +++ b/app/realtime.php @@ -847,6 +847,17 @@ $server->onMessage(function (int $connection, string $message) use ($server, $re if (!empty($projectId) && $projectId !== 'console') { $project = $authorization->skip(fn () => $database->getDocument('projects', $projectId)); + if ($project->isEmpty()) { + Console::warning(sprintf( + '[realtime-project-diag] projectId=%s consoleDb=%s consoleNs=%s consoleTenant=%s consoleShared=%s — project lookup returned empty, will fall back to console', + $projectId, + $database->getDatabase(), + $database->getNamespace(), + (string) ($database->getTenant() ?? 'null'), + $database->getSharedTables() ? 'yes' : 'no' + )); + } + $database = getProjectDB($project); $database->setAuthorization($authorization); } else {