Abort a waitForJob wait with AbortSignal: the Sume job keeps running

Passing signal to waitForJob stops your wait and aborts the in-flight request. It does not cancel the job, which keeps running and billing. Keep the job id.

4 min readSume
All posts

Aborting a waitForJob call with an AbortSignal ends your wait, not the job. The in-flight status request is aborted, the call rejects with the signal's reason, and the Sume job keeps running and billing. To stop the work itself, call the cancel endpoint, which succeeds only before generation has started.

What the SDK does on abort

The signal option is checked before each poll and passed to each request, and the sleep between polls is also cut short when the signal fires. The Jobs docs say the same about any client-side timeout: it does not cancel the job, and you only stopped the wait.

What an abort changes (read 2026-10-06)
ThingAfter abort
Your waitForJob promiseRejects with signal.reason
The in-flight status requestAborted
The Sume jobKeeps running and billing
The job idStill valid: read /v1/jobs/:id later

Stop waiting, keep the id

Store the job id before you start waiting. After an abort, the same id lets you resume with another waitForJob call, or read it once with GET /v1/jobs/:id.

import { createSumeClient, waitForJob } from "@sume-com/sdk";

const client = createSumeClient({ apiKey: process.env.SUME_API_KEY! });
const jobId = process.argv[2]!;
const controller = new AbortController();
setTimeout(() => controller.abort(), 60_000);

try {
  const job = await waitForJob(jobId, { client, signal: controller.signal });
  console.log(job.status);
} catch (error) {
  if (!controller.signal.aborted) throw error;
  console.log("stopped waiting; job still runs:", jobId);
}

If you also want the job to stop

POST /v1/jobs/:id/cancel works only before generation work starts. After that the API answers 409 job_generation_already_started with details.cancelable: false, and the job runs to completion. Calling cancel on a job that is already canceled returns the same canceled job.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume