context.cancel is different — it allows you to explicitly cancel the current workflow run.
- It is labeled as canceled (not failed).
- The configured
failureFunctionis not triggered. - No entries are sent to the dead-letter queue (DLQ).
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Explicitly cancel the current workflow run from within your code using the Upstash Workflow context.cancel method.
context.cancel is different — it allows you to explicitly cancel the current workflow run.
export const { POST } = serve<{ topic: string }>(async (context) => {
const payload = context.requestPayload
const result = await context.run("check if canceled", () => { ... });
if (result.cancel) {
await context.cancel() // cancel the workflow run
}
})
failureFunction is not triggered.Was this page helpful?