diff --git a/src/lib/actions/agents.ts b/src/lib/actions/agents.ts index 08ed7f0..05d4f76 100644 --- a/src/lib/actions/agents.ts +++ b/src/lib/actions/agents.ts @@ -44,7 +44,7 @@ export async function getAgents(clientSiteUuid?: string): Promise { } } catch (connErr: any) { console.error("[getAgents Action] Connection failed:", connErr.message); - throw connErr; + return []; // Do not throw to avoid Next.js Server Component crash } const db = mongoose.connection.db; @@ -71,8 +71,8 @@ export async function getAgents(clientSiteUuid?: string): Promise { return result.data || []; } catch (error: any) { - console.error("Error fetching agents:", error); - throw new Error(error.message || "Failed to retrieve agents inventory."); + console.error("[getAgents Action] Error fetching agents:", error); + return []; // Do not throw to avoid Next.js Server Component crash } }