Next.js Discord

Discord Forum

❓ How to Properly Configure Webhooks for Strapi + Next.js Static Site Hosted on Azure DevOps?

Unanswered
Cape lion posted this in #help-forum
Open in Discord
Cape lionOP
Hi everyone,
I'm facing an issue and would really appreciate your help.
I'm using Strapi as the CMS and Next.js for the frontend. I hosted the frontend as a static site in Azure DevOps.
I have configured webhooks in Strapi to trigger revalidation in Next.js whenever content is updated. Here's the code I'm using in my route.ts:
route.ts

import { NextRequest, NextResponse } from "next/server";
import { revalidatePath } from "next/cache";
import { log } from "console";

export async function POST(req: NextRequest) {
const body = await req.json();
const model = body?.model;

log("Webhook body --> ", body);
const path = model === "homepage" ? "/" : /${model};

if (!model) {
return NextResponse.json({ message: "Missing model" }, { status: 400 });
}

try {
revalidatePath(path);
return NextResponse.json({ revalidated: true, path: path });
} catch (err) {
console.error("Error revalidating:", err);
return NextResponse.json({ message: "Error revalidating" }, { status: 500 });
}
}

When I run the app locally (npm run build && npm run start), everything works fine — the changes reflect correctly.
But after deploying the site to Azure DevOps as a static site, the real-time updates are not reflecting (especially on the homepage, header, and footer which are inside the layout).
Questions:

Is the problem from my side (webhook/revalidatePath config)?

Or is it because of how I'm hosting it (Azure Static Site)?

Or is it something from Strapi's side?

How can I correctly make real-time updates reflect on the live site?
Any help would be greatly appreciated! 🙏

0 Replies