From c45aefde6ef5ffa9bd42bafb522fe93072220a69 Mon Sep 17 00:00:00 2001 From: Unchained Date: Fri, 6 Mar 2026 16:34:00 +0200 Subject: [PATCH] Add error handling to sitemap.ts for build time --- src/app/sitemap.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/app/sitemap.ts b/src/app/sitemap.ts index 2dacc55..94921de 100644 --- a/src/app/sitemap.ts +++ b/src/app/sitemap.ts @@ -4,7 +4,12 @@ import { getProducts } from "@/lib/woocommerce"; export default async function sitemap(): Promise { const baseUrl = process.env.NEXT_PUBLIC_SITE_URL || "https://dev.manoonoils.com"; - const products = await getProducts(); + let products: any[] = []; + try { + products = await getProducts(); + } catch (e) { + console.log('Failed to fetch products for sitemap during build'); + } const productUrls = products .filter((p) => p.status === "publish")