Incremental Static Regeneration (ISR) not working for [slug].js file

Hello team,

My nextjs changes not reflected in netlify server, but its working in local machine. also the issue only in [slug].js file, in other template file working fine.

For deployment using “Essential Next.js” plugin.

Updates:- Its working fine When I tried to deploy in vercel, the issue only in netlify server.

some codes in [slug].js file


import { getService, getServicePagecount, getAllServiceWithSlug } from "../../lib/api"; 
import ServiceDetails from "../../components/Services/Details";

export async function getStaticProps({ params, preview = null }) {
    const serviceData = await getService(params.slug, preview); 
    
    let notfound = false;
    if (!serviceData.service) {
        notfound = true;
    } 
    return {
        props: { serviceData },
        revalidate: 1,
        notFound: notfound
    }
}
export async function getStaticPaths() { 
    const allServices = await getPaginateddata();
    return {
        paths: allServices?.map((blog) => `/${blog.full_slug}`) || [],
        fallback: 'blocking',
    }
}
async function getPaginateddata() {
    const output = [];
    const pagesize = 100;
    const allPosts = await getServicePagecount();
    const totalpages = Math.ceil(allPosts.total / pagesize);
    for (let i = 1; i <= totalpages; i++) {
      const data = await getAllServiceWithSlug(i, pagesize);
      output.push(...data);
    }
    return output;
}

export default function Blog({ serviceData }) { 
    const headerContent = header[0].content;
    const footerContent = footer[0].content;  
    const serviceDataList = serviceData.service.content;
    const testimonialsData = testimonials[0].content.body;
    const casestudiesData = casestudyList; 
    return ( 
            <ServiceDetails 
                content={serviceDataList}  
            /> 
    )
}

hi there, thanks for that. in order to evaluate this a bit more, can you tell us a bit more information about what you are trying to do, how you are expecting it to work and what exaclty is happening when it “doesn’t work”? thanks!

It’s a bit hard to tell from just this code snippet, but I reckon your service components need a running server. It would, at least, explain why your code is running locally and on vercel, but not on Netlify. Here’s more information on what Netlify can and cannot do:

In addition to that mentioned already, there is a great blog post about ISR which talks about how Netlify handles things

Hello perry,

Im briefing your questions below

  1. what you are trying to do?
    ans:- Im basically creating a static website, it has 4 pages those are home, about, blog and blog details. I’m using nextjs, and the blog detail page is an ISG/ISR page, 100 of pages under in blog details page. So the page is a [slug].js file.

  2. how you are expecting it to work?
    ans: - The website content setting up with storyblok, so when I updating the contents in storyblok admin page the changes should reflecting in our netlify server. because I’ve added nextjs revalidate prop for this.

  3. what exaclty is happening when it “doesn’t work”?
    ans:- The issue when I updating the contents in storyblok admin the changes not reflecting in slug page. but the other pages working fine (home, about, blog). In dev mode the changes reflecting that’s why I mentioned this working in local but not in build mode. But in vercel the changes reflecting in slug page as expecting.

When reading some comments in issue page I realise ISR/ISG doesn’t fully support by netlify.

Hi there, @nikhil :wave:

Thanks for following up! I see that this thread has been a bit quiet since you last wrote in. My apologies for the delay. Are you still encountering obstacles here? Please let me know if you are, and I will bring this back to the Support Team again. I appreciate your patience.

Hello @hillary thanks for the support, yes Im still facing the issue. So to remove the SSR working I have applied the value as false on revalidate props in getStaticProps and fallback props in getStaticPaths functions. Now the SSR will not work, this is out of my requirement. It will be good if you solve the SSR issue in your Essential Next.js package.

Hey there, Nikhil :wave:

Thanks for following up! I have spoken with our NextJS folks, and they would like you to bring this conversation to our new Beta Plugin space: v4 beta release · Discussion #706 · netlify/next-runtime · GitHub. There are some great conversations happening there, and you will be able to work more closely with the experts who wrote the plugin. Let me know if this works for you!

Hillary

Hello Hillari, thanks for the reply. The discussion link might be helpful for the issue. let me check it

1 Like