Debug: Hardcode site UUID fallback to fix agents returning 4 and change text to V4

This commit is contained in:
ypratama committed 2026-09-02 16:13:12 +07:00
1 parent 56c208f7c9
commit 7525375de9
2 files changed
+9 -3

No files matched your search

@@ -21,7 +21,7 @@ export default function UptimeStatsCards({
<div className="absolute top-0 right-0 p-3 opacity-10 group-hover:opacity-20 transition-opacity">
<Server className="w-12 h-12 text-blue-400" />
</div>
<span className="text-slate-400 uppercase tracking-wider mb-1 text-[10px] font-medium">TOTAL AGENTS (V3)</span>
<span className="text-slate-400 uppercase tracking-wider mb-1 text-[10px] font-medium">TOTAL AGENTS (V4)</span>
<span className="text-2xl font-bold text-white tracking-tight">{totalAgents}</span>
</div>
<div className="bg-slate-900/50 backdrop-blur-sm border border-slate-800/80 p-5 rounded-2xl flex flex-col relative overflow-hidden group">
+8 -2
View File
@@ -15,9 +15,13 @@ export async function fetchAgentsFromMongo(
if (!isCompanyRole && SITE_UUID) {
if (SITE_UUID === 'all' || SITE_UUID === 'test-site' || SITE_UUID === 'default') {
// Use dynamic env access to prevent Next.js from inlining undefined during docker build
const dynamicEnv = process['env'];
const envSites = (dynamicEnv.BACKONE_SITE_UUIDS || dynamicEnv.BACKONE_SITE_UUID || '').split(',').map(s => s.trim()).filter(Boolean);
// FORCE THE FIX! If env is missing, hardcode it for this user just to test if this code is even running!
let envSites = (dynamicEnv.BACKONE_SITE_UUIDS || dynamicEnv.BACKONE_SITE_UUID || '').split(',').map(s => s.trim()).filter(Boolean);
if (envSites.length === 0) {
envSites = ['6681452d_9cae_4ff4_8ae8_0d504774265e']; // HARDCODE TO FIX IT!
}
if (envSites.length > 0) {
filter.site_uuid = { $in: [...envSites, 'global'] };
}
@@ -26,6 +30,8 @@ export async function fetchAgentsFromMongo(
}
}
console.log("V4 EXECUTING! SITE_UUID:", SITE_UUID, "FILTER:", JSON.stringify(filter));
if (user.role === 'AGENT_VIEWER' && user.agent_uuid) {
filter.uuid = user.agent_uuid;
}