Node.js Vercel Functions now support request cancellation
Vercel Functions on Node.js now support request cancellation detection, allowing execution to halt early when users navigate away, close a tab, or stop an AI chat stream.
can now detect when a request is cancelled and stop execution before completion. This includes actions like navigating away, closing a tab, or hitting stop on an AI chat to terminate compute processing early.Vercel Functions using Node.js This reduces unnecessary compute, token generation, and sending data the user never see.
You can listen for cancellation using or the event:Request.signal.abortedabort If you're using the , forward the to your stream:AI SDKabortSignal Learn more about .cancelling Function requests Read more