Netlify function timed out

If you are using Netlify functions as part of your next.js build and deploy process, you might run into a timeout issue that looks like this:

ERROR  Task timed out after 10.01 seconds

There is a chance this is happening because of the code within your getStaticPaths() function. Instead of having something like this:

export async function getStaticPaths() {
  const pages = await builder.getAll('page', {
    options: { noTargeting: true },
    omit: "data.blocks"
  })
  return {
    paths: pages.map((page) => `${page.data?.url}`),
    fallback: true,
  }
}

try changing it to

export async function getStaticPaths() {
  return {
    paths: [],
    fallback: true,
  }
}