So I am working on moving a nextjs site to prismic, and I have setup a test server in netlify, I have created the build hook in netlify and saved it in the webhook in prismic settings. Whenever I make a change in the site I can see that the webhook in prismic is triggered with a 200 status code and a build is started in netlify. However once the build is finished and I reload the page, changes are not displayed. I tried clearing cache and opening in incognito and nothing changes, I can only see the new changes if I manually build the site again with the "clear cache and retry with latest commit" button.
I am using a secret and custom tag
and here is my api/revalidate/route.js
import { NextResponse } from "next/server";
import { revalidateTag } from "next/cache";
export async function POST(request) {
const { secret } = await request.json();
const tag = request.headers.get('tag');
if (secret !== process.env.REVALIDATION_TOKEN) {
return NextResponse.json({ message: 'Invalid secret' }, { status: 401 })
}
if (!tag) {
return NextResponse.json(
{ message: "Missing tag header" },
{ status: 400 }
)
}
revalidateTag(tag);
return NextResponse.json(
{ revalidated: true, now: Date.now() },
{ status: 200 }
);
}
And I have also included the env var in netlify
any help would be appreciated.