Next.js Discord

Discord Forum

revalidate not working on NextJS 14.2.3

Unanswered
Cape lion posted this in #help-forum
Open in Discord
Cape lionOP
Hi, im trying to use revalidate on a page, but for some reason it is not revalidating. any idea why this is happening?
Inside Loader fetch data from a path in apps/api. I've been trying for a while to find why it's not working, I also passed the revalidate inside the fetch, but it's not working.


//Page
export const revalidate = 30;

export default function Page() {
    return <Loader />;
}


//app/api/endpoint/route.ts
export const fetchCache = 'default-cache';

export async function GET(request: Request) {
    const res = await fetch(process.env.URL as string, {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json',
        },
        body: JSON.stringify({}),
    });
    const data = await res.json();

    return Response.json(data);
}

0 Replies