How To
Cancel a run
You can cancel a running workflow both programatically and from your Upstash Workflow console.
Cancelling via console
In your Upstash Workflow console, find the run you’d like to cancel and press the Cancel Workflow
button on the right side:
Cancelling programatically
api/workflow/route.ts
import { serve } from "@upstash/qstash/nextjs";
export const POST = serve(
async (context) => {
// 👇 cancel a running workflow
await context.qstashClient.workflow.cancel("<WORKFLOW_RUN_ID>")
},
);
And replace <WORKFLOW_RUN_ID>
with your actual run ID. You can also use the Upstash Workflow REST API to cancel a run programatically.
Was this page helpful?