You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add `schedule` property to Workflow bindings for cron-based triggering
6
+
7
+
> **Note:** This is a configuration-only change. Scheduled triggering of Workflow instances is not yet available — adding `schedule` to a Workflow binding will not result in scheduled invocations at this time. This change lays the groundwork for an upcoming feature.
8
+
9
+
Workflow bindings in `wrangler.json` now accept an optional `schedule` field that configures one or more cron expressions to automatically trigger new workflow instances on a schedule.
10
+
11
+
```jsonc
12
+
// wrangler.json
13
+
{
14
+
"workflows": [
15
+
{
16
+
"binding":"MY_WORKFLOW",
17
+
"name":"my-workflow",
18
+
"class_name":"MyWorkflow",
19
+
"schedule":"0 9 * * 1",
20
+
},
21
+
],
22
+
}
23
+
```
24
+
25
+
Multiple schedules can be provided as an array:
26
+
27
+
```jsonc
28
+
{
29
+
"workflows": [
30
+
{
31
+
"binding":"MY_WORKFLOW",
32
+
"name":"my-workflow",
33
+
"class_name":"MyWorkflow",
34
+
"schedule": ["0 9 * * 1", "0 17 * * 5"],
35
+
},
36
+
],
37
+
}
38
+
```
39
+
40
+
The schedule is sent to the Workflows control plane on `wrangler deploy`. Configuring `schedule` on a workflow binding that references an external `script_name` is an error — the schedule must be configured on the worker that defines the workflow.
- "workflows[0]" bindings should, optionally, have a string or array of strings "schedule" field but got {"binding":"MY_WORKFLOW","name":"my-workflow","class_name":"MyWorkflow","schedule":123}."
5354
+
`);
5355
+
});
5356
+
5357
+
it("should error if schedule is an empty string",({ expect })=>{
- "workflows[0]" bindings should, optionally, have a string or array of strings "schedule" field but got {"binding":"MY_WORKFLOW","name":"my-workflow","class_name":"MyWorkflow","schedule":["*/5 * * * *",123]}."
5428
+
`);
5429
+
});
5430
+
5431
+
it("should error if schedule is an array containing empty strings",({
0 commit comments