Node.js Vercel Functions now support per-path request cancellation
By Steven Van ·
Adding one flag to vercel.json lets Node.js functions stop work when a request is cancelled, including mid-stream AI SDK calls.
Vercel Functions written in Node.js can now stop execution when a request is cancelled, instead of running to completion after a user has already navigated away, closed a tab, or hit stop on an AI chat. Support is enabled per path by adding "supportsCancellation": true to a function's entry in vercel.json. Once enabled, cancellation can be detected with Request.signal.aborted or an abort event listener; AI SDK users can forward req.signal as the abortSignal on a streamText call so a stopped chat also halts the model stream. Vercel says this cuts unnecessary compute, token generation, and data sent to a client that will never see it.
Full details are in Vercel's Node.js runtime documentation, via the changelog entry.