createTestHarness can list Durable Object IDs
Introduced 2026-07-09 · score 0.92
HOW TO USE IT
When an integration test needs persisted Durable Object IDs, call `listDurableObjectIds(<bindingName>)` on the `WorkerHandle` returned by `createTestHarness().getWorker()`. It returns a promise of string IDs for instances with persisted storage on that binding.
import { createTestHarness } from "wrangler";
const server = createTestHarness({ workers: [{ configPath: "./wrangler.jsonc" }] });
const worker = server.getWorker();
const ids = await worker.listDurableObjectIds("<bindingName>");WHY THIS HELPS
Discover persisted Durable Object instances in an integration test using `createTestHarness`.
REQUIREMENTS AND LIMITATIONS
- Version: 4.109.0
- bindingName (required): Name of a Durable Object namespace binding configured on the Worker; the method returns persisted instance IDs as strings.
- workers[].configPath (required): Path to the Wrangler configuration file for the Worker; relative paths resolve from the harness root.
- Prerequisite: Use a Worker project with a Wrangler configuration file, a Node.js test runner, and Wrangler installed as a development dependency.
- The IDs are for persisted Durable Object instances associated with a Durable Object binding.
- Docs conflict: The newer Wrangler API page, last updated Sep 28, 2026, omits `listDurableObjectIds` from its listed WorkerHandle methods; the Wrangler 4.109.0 source defines it. https://developers.cloudflare.com/workers/wrangler/api/
FIRST-PARTY EVIDENCE
- https://github.com/cloudflare/workers-sdk/releases/tag/wrangler%404.109.0
- https://github.com/cloudflare/workers-sdk/blob/wrangler@4.109.0/packages/wrangler/src/api/test-harness.ts
- https://developers.cloudflare.com/workers/testing/test-harness/configure/
- https://developers.cloudflare.com/workers/testing/test-harness/get-started/
Check the installed version and the source before using it. Entry JSON