Skip to main content

Vercel Functions now support graceful shutdown

By Steven Van ·

Node.js and Python functions get a 500ms SIGTERM window to close connections or flush logs before termination.

Vercel Functions that run on Node.js and Python can now shut down gracefully instead of stopping immediately. When a function is terminated, such as during scale-down, the runtime sends a SIGTERM signal, and the function gets up to 500 milliseconds to run cleanup tasks like closing database connections or flushing external logs before it ends.

Using it means listening for the signal in the function code, for example process.on('SIGTERM', ...) in Node.js. Read the announcement on Vercel's changelog for the code sample and a link to more on the SIGTERM signal.

Vercel
Vercel
The platform for frontend developers — deploy, preview, and scale web apps and AI agents with zero config.
View Vercel →

Original source

Read Vercel Functions now support graceful shutdown on Creators Toolbox