Path re validation issue on deployment of Next.js project on Azure static site.
Unanswered
Eared Trogon posted this in #help-forum
Eared TrogonOP
Hi everyone,
I'm facing an issue and would appreciate your help.
I'm using Strapi as CMS and Next.js for frontend. I deployed the frontend as a static site in Azure DevOps.
I configured webhooks in Strapi to trigger revalidation in Next.js when content updates. Here's my route.ts:
Issue:
Locally (npm run build && npm run start), real-time updates work fine.
After deploying to Azure DevOps static site, updates (on homepage, header, footer) don’t reflect.
Other routes (e.g., /about-us) revalidate correctly.
Questions:
Is the issue with my webhook or revalidate config?
Is it because I'm hosting as a static site?
Is it something from Strapi?
How can I make real-time updates reflect properly on the live site?
Any help would be appreciated! 🙏
I'm facing an issue and would appreciate your help.
I'm using Strapi as CMS and Next.js for frontend. I deployed the frontend as a static site in Azure DevOps.
I configured webhooks in Strapi to trigger revalidation in Next.js when content updates. Here's my route.ts:
import { NextRequest, NextResponse } from "next/server";
import { revalidatePath, revalidateTag } 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 {
if (model === 'homepage') {
console.log('Revalidating homepage');
revalidatePath('/');
return NextResponse.json({ revalidated: true, path: '/' });
}
if (model === 'header') {
console.log('Revalidating header');
revalidateTag('header');
return NextResponse.json({ revalidated: true, path: 'header&footer' });
}
revalidatePath(path);
return NextResponse.json({ revalidated: true, path: path });
} catch (err) {
console.error('Error revalidating:', err);
return NextResponse.json({ message: 'Error revalidating' }, { status: 500 });
}
}
Issue:
Locally (npm run build && npm run start), real-time updates work fine.
After deploying to Azure DevOps static site, updates (on homepage, header, footer) don’t reflect.
Other routes (e.g., /about-us) revalidate correctly.
Questions:
Is the issue with my webhook or revalidate config?
Is it because I'm hosting as a static site?
Is it something from Strapi?
How can I make real-time updates reflect properly on the live site?
Any help would be appreciated! 🙏