Builder.io example "next-js-on-demand-isr" not working (probably due to caching)

Hi Builder Team :wave:

Describe the bug
I used and set up the next-js-on-demand-isr example from your repository. For this, I followed exactly all the steps listed in the README.

Unfortunately, I am currently running into a problem. The problem is that “on-Demand ISR” is not working properly in production. The revalidate endpoint in Next.js must be called several times before the changes are visible.

I have a feeling this is due to caching within Builder.io’s API.

To Reproduce
Follow the steps in the README from the example next-js-on-demand-isr.

Expected behavior
When the webhook calls the revalidation endpoint, the new content should be visible on the production environment.

Video
I uploaded a screen recording with the issue.

buillder-nextjs-on-demand-ISR.webm

Hi @aaron5670, Welcome to Builder.io Forum!

We hope you’re doing well.

Thanks for sharing the details of your issue so concisely!

The changes might not be immediate when publishing your pages due to caching. Caching helps us ensure the best possible performance while keeping content reasonably fresh. We use a technique called stale-while-revalidating caching 21 which updates the data based on how frequently data is requested. For example, if you update the content, but no one visits your site, your content may not update right away. The next time a user visits the site, they’ll see the cached version, while the latest version is fetched in the background and the cache is updated. The next visitor (after a few seconds) will see the new version.
You can control the cache length via query params in the request to our content api 37. We recommend keeping the default values though, since reducing cache time can negatively affect performance. Generally speaking, a development site (that is not live) could be a little stale, but a live site with real traffic will always be fast and fresh. If you want to manually ensure pages are updated, but you have no one on your website visiting them, you can always just visit them once or twice after updating to ensure we fetch the latest version.

Let us know if you have any further questions or concerns. I’d be happy to assist :slight_smile: