Next.js Discord

Discord Forum

Manual Graceful Shutdowns in App Router

Unanswered
Sloth bear posted this in #help-forum
Open in Discord
Sloth bearOP
In the documentation for Pages Router, there is a section on [Manual Graceful Shutdowns](https://nextjs.org/docs/pages/building-your-application/deploying#manual-graceful-shutdowns) which involves placing SIGINT and SIGTERM handling in your pages/_document.js :

if (process.env.NEXT_MANUAL_SIG_HANDLE) {
  process.on('SIGTERM', () => {
    console.log('Received SIGTERM: cleaning up')
    process.exit(0)
  })
  process.on('SIGINT', () => {
    console.log('Received SIGINT: cleaning up')
    process.exit(0)
  })
}


I'd like to know how to implement this with App Router. I've been unable to answer this question for many months. Back in August, 2023, the App Router docs had a section for Manual Graceful Shutdowns, but it was just the Pages Router instructions copied in there and they have since removed it and not replaced it with anything. I have also searched this forum. A similar question was asked last year and received no responses.

Does anyone know if Manual Graceful Shutdowns as shown with Pages Router possible at all with App Router? Thank you for any responses!

Edit: I have found GitHub issues like [#51404](https://github.com/vercel/next.js/issues/51404) so I'm guessing the answer is still no.

0 Replies