While working on a recent Sitecore XM Cloud project, I ran into a frustrating issue when trying to build my Next.js app locally using pnpm run build
. No matter what I tried, the build kept failing with a 60-second timeout. The error message always began with:
⚠ Sending SIGTERM signal to Next.js build worker due to timeout of 60 seconds. Subsequent errors may be a result of the worker exiting.
If you’ve encountered this error and are stuck like I was — don’t worry. In this post, I’ll walk you through what’s causing it and how to fix it.
Below you can see the full I got when I was working on building my app locally:
As indicated by the link in the stack trace, Next.js automatically restarts the worker pool responsible for page data generation if it detects no progress for a certain period—this is meant to prevent builds from hanging indefinitely. When the worker pool restarts, it retries all unfinished jobs. However, if a job fails repeatedly, it can still result in an error.
To fix this, you can increase the timeout for static page generation using the staticPageGenerationTimeout option. Here’s how to configure it in your next.config.js file:
Hopefully, this walkthrough saves you some time and frustration during your Next.js and Sitecore XM Cloud builds. Happy coding!
No comments:
Post a Comment