diff --git a/src/app/(dashboard)/agents/UptimeStatsCards.tsx b/src/app/(dashboard)/agents/UptimeStatsCards.tsx index 6b2877f..c13864c 100644 --- a/src/app/(dashboard)/agents/UptimeStatsCards.tsx +++ b/src/app/(dashboard)/agents/UptimeStatsCards.tsx @@ -21,7 +21,7 @@ export default function UptimeStatsCards({
- TOTAL AGENTS (V3) + TOTAL AGENTS (V4) {totalAgents}
diff --git a/src/lib/actions/agentsMongo.ts b/src/lib/actions/agentsMongo.ts index b867f11..ed977ef 100644 --- a/src/lib/actions/agentsMongo.ts +++ b/src/lib/actions/agentsMongo.ts @@ -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'] }; } @@ -25,6 +29,8 @@ export async function fetchAgentsFromMongo( filter.site_uuid = { $in: [SITE_UUID, 'global'] }; } } + + 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;