Skip to content

Commit ca9fc81

Browse files
authored
Merge branch 'production' into elithrar-patch-26
2 parents 68ab357 + 801f5c8 commit ca9fc81

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

src/content/changelogs/workflows.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@ entries:
1111
Workflows now allow you to define up to 512 steps in a single Workflow definition, up from the previous limit of 256. This limit will continue to increase during the course of the open beta.
1212
1313
If you have Workflows that need more steps, we recommend delegating additional work to other Workflows by [triggering a new Workflow](/workflows/build/trigger-workflows/) from within a step and passing any state as [parameters to that Workflow instance](/workflows/build/events-and-parameters/).
14+
- publish_date: "2024-11-21"
15+
title: "Fixed create instance API in Workers bindings"
16+
description: |-
17+
You can now call `create()` without any arguments when using the [Workers API](/workflows/build/workers-api/#create) for Workflows. Workflows will automatically generate the ID of the Workflow on your behalf.
18+
19+
This addresses a bug that caused calls to `create()` to fail when provided with no arguments.
20+
- publish_date: "2024-11-20"
21+
title: "Multiple Workflows in local development now supported"
22+
description: |-
23+
Local development with `wrangler dev` now correctly supports multiple Workflow definitions per script.
24+
25+
There is no change to production Workflows, where multiple Workflow definitions per Worker script was already supported.
1426
- publish_date: "2024-10-23"
1527
title: "Workflows is now in public beta!"
1628
description: |-

src/content/docs/workflows/build/workers-api.mdx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,24 @@ Get a specific Workflow instance by ID.
194194

195195
* `id` - the ID of the Workflow instance.
196196

197-
Returns a `WorkflowInstance`.
197+
Returns a `WorkflowInstance`. Throws an exception if the instance ID does not exist.
198+
199+
```ts
200+
// Fetch an existing Workflow instance by ID:
201+
try {
202+
let instance = await env.MY_WORKFLOW.get(id)
203+
return Response.json({
204+
id: instance.id,
205+
details: await instance.status(),
206+
});
207+
} catch (e: any) {
208+
// Handle errors
209+
// .get will throw an exception if the ID doesn't exist or is invalid.
210+
const msg = `failed to get instance ${id}: ${e.message}`
211+
console.error(msg)
212+
return Response.json({error: msg}, { status: 400 })
213+
}
214+
```
198215

199216
## WorkflowInstanceCreateOptions
200217

0 commit comments

Comments
 (0)