diff --git a/src/app/api/social/route.ts b/src/app/api/social/route.ts index 1bb06b9..2d93643 100644 --- a/src/app/api/social/route.ts +++ b/src/app/api/social/route.ts @@ -618,7 +618,9 @@ export async function GET(req: NextRequest) { until ); metrics.facebook = fb; - if (Array.isArray(fb.posts)) posts.push(...fb.posts); + if (!('error' in fb && fb.error) && Array.isArray(fb.posts)) { + posts.push(...fb.posts); + } } if (igInteg?.external_account_id) { const ig = await fetchIgBundle( @@ -628,7 +630,9 @@ export async function GET(req: NextRequest) { until ); metrics.instagram = ig; - if (Array.isArray(ig.posts)) posts.push(...ig.posts); + if (!('error' in ig && ig.error) && Array.isArray(ig.posts)) { + posts.push(...ig.posts); + } } } catch (e) { metrics.warning = e instanceof Error ? e.message : 'metrics error';