diff --git a/app/admin/(protected)/autogen/page.js b/app/admin/(protected)/autogen/page.js index 23942de..b07a812 100644 --- a/app/admin/(protected)/autogen/page.js +++ b/app/admin/(protected)/autogen/page.js @@ -11,12 +11,17 @@ const ENGINE_URL = process.env.ENGINE_URL || 'http://127.0.0.1:3030'; const ENGINE_SECRET = process.env.ENGINE_SECRET || 'zeropost_internal_2026'; async function engineCall(path) { - const res = await fetch(`${ENGINE_URL}${path}`, { - headers: { 'x-internal-secret': ENGINE_SECRET }, - cache: 'no-store', - }); - if (!res.ok) return null; - return res.json(); + try { + const res = await fetch(`${ENGINE_URL}${path}`, { + headers: { 'x-internal-secret': ENGINE_SECRET }, + cache: 'no-store', + }); + if (!res.ok) return null; + return await res.json(); + } catch (err) { + console.error(`[autogen/page] engineCall ${path} failed:`, err.message); + return null; + } } export default async function AutogenPage() { diff --git a/app/zero/page.js b/app/zero/page.js index 2f87467..1dc6964 100644 --- a/app/zero/page.js +++ b/app/zero/page.js @@ -11,10 +11,13 @@ export const metadata = { }; export default async function ZeroPage() { - const [notes, character] = await Promise.all([ + // defensive: один битый источник не должен валить страницу + const results = await Promise.allSettled([ listZeroNotes({ limit: 100 }), getZeroCharacter(), ]); + const notes = results[0].status === 'fulfilled' ? results[0].value : []; + const character = results[1].status === 'fulfilled' ? results[1].value : null; return ( <>