Can we Schedule deployments in vercel Deploy Hooks?(Next.js)

Viewed 355

Like when we Schedule a Pipeline on git, I want to schedule Deploy hooks on vercel

Because the app is sending getStaticProps
and every HTTP request will be run on every build
so i have to rebuild site to geet new results from server

for example I want to Redeploy my app on vercel every day at 02:00PM

how can i do that

1 Answers

According to the Nextjs document you don't need to do this, there is a simpler and better solution:

Next.js allows you to create or update static pages after you’ve built your site. Incremental Static Regeneration (ISR) enables you to use static-generation on a per-page basis, without needing to rebuild the entire site. With ISR, you can retain the benefits of static while scaling to millions of pages.

So you can use this feature like this:

export async function getStaticProps() {
  // some code on getstaticProps

  return {
    props: {
      // the props 
    },
    // Next.js will attempt to re-generate the page:
    // - When a request comes in
    // - At most once every 10 seconds
    revalidate: 10, // In seconds
  }
}

for more information look at this link

Related