Search code examples
next.jsstatic-site-generation

Next.js staticPageGenerationTimeout not working


I have put this in my next.config.js file (Next.js 11.1.3):

const path = require("path");

module.exports = {
   sassOptions: {
      includePaths: [path.join(__dirname, "styles")],
   },
   trailingSlash: true,
   staticPageGenerationTimeout: 1000,
};

However, the error I get is this:

warn  - Restarted collecting page data for /blog/[slug] because it took more than 60 seconds
warn  - See more info here https://nextjs.org/docs/messages/static-page-generation-timeout

It's mentioning 60 seconds which is the default value and seems like the custom value I've provided isn't working. What's wrong?


Solution

  • Next.js 11 doesn't have staticPageGenerationTimeout. You need to upgrade to 12 or higher.

    Of course, if you have to up your timeout you should consider if there is a promise not resolving, an infinite loop, or slow network calls that you can fix before upping the limit. See also Static page generation timed out after multiple attempts on the Next website.

    Note: Credit where credit is due. This is answered in the comments but the comment is easy to miss (I missed it at first!) and it's been months, so I'm writing this as an answer in hopes of saving some people time.