ISR not working

I don’t know if I’m doing something wrong but ISR isn’t working on my site, but on Vercel it does.

This is the url: https://ondemand-isr.netlify.app/about

I’m using this code on the page

export const revalidate = 60;

I make a change in the content in Sanity and even if I wait for a couple of minutes it doesn’t show in the frontend.

Hi @marnau, based on the information you have provided, I see you want to use On-demand Next.js ISR.

Note that at the moment, Netlify does not support On-demand ISR.

The information below is quoted from the Netlify Documentation website.

On-demand ISR

On-demand ISR (where a path is manually revalidated) is not currently supported on Netlify.

Checkout the Netlify Documentation link below for more information.

Hope the above helps.

Thanks.

Hi @clarnx, thanks for the reply.

No, I want to use time based revalidation, that’s why I used the revalidate = 60 interval. This is supported by Netlify, isn’t it?

Am I doing something wrong? Am I supposed to do something extra? My implementation does work in Vercel.

Thanks

Hi @marnau, thanks for the feedback
Since you stated it works on Vercel but not on Netlify, I can’t tell for sure what the problem might be. There could be many reasons why the problem occurs.

However in order to narrow down what might be causing the problem, I suggest you create a minimal version of your application with the same revalidate option and then see if it works.
If it does not work you can also share the feedback with some code snippets.

Thanks.

Hi, and thanks again, @clarnx.

What I’m testing is a minimal version of the application. It’s a very simple two-page app.
The only thing I’m doing is fetching a string from Sanity:

import { getAbout } from "@/sanity/queries";
import Link from "next/link";

export const revalidate = 60;

export default async function About() {
  const [{ title }] = await getAbout();

  return (
    <div className="content about">
      <div className="title">About</div>
      <Link href="/">Go to Home</Link>
      <div className="text">{title}</div>
    </div>
  );
}

And getAbout is defined like this:

export function getAbout() {
  return client.fetch(
    groq`
      *[_type == "about"] {
        title,
        image
      }
`);
}

I solved the issue by adding a second parameter to the fetch call: { next: { revalidate: 60 } }.

The fetch call looks like this in the end:

export function getAbout() {
  return client.fetch(
    groq`
      *[_type == "about"] {
        title,
        image
      }
    `,
    { next: { revalidate: 60 } }
  );
}

So I’m telling it to revalidate both in the fetch and in the whole route.

The conclusion seems to be that Netlify is listening to this parameter in the fetch call, but not to the route revalidate constant, whereas Vercel has enough with the latter.

1 Like

Hi @marnau, thanks for sharing how you solved your problem.

1 Like