Skip to content

Commit 7563c53

Browse files
authored
[Workflows] Add waitForEvent type limitations (#26758)
1 parent 4f17170 commit 7563c53

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/content/docs/workflows/build/events-and-parameters.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ A running Workflow can wait for an event (or events) by calling `step.waitForEve
7878

7979
Because `waitForEvent` is part of the `WorkflowStep` API, you can call it multiple times within a Workflow, and use control flow to conditionally wait for an event.
8080

81-
Calling `waitForEvent` requires you to specify an `type`, which is used to match the corresponding `type` when sending an event to a Workflow instance.
81+
Calling `waitForEvent` requires you to specify an `type` (up to 100 characters [^1]), which is used to match the corresponding `type` when sending an event to a Workflow instance.
8282

8383
For example, to wait for billing webhook:
8484

@@ -150,7 +150,7 @@ export default {
150150
</TypeScriptExample>
151151

152152
- Similar to the [`waitForEvent`](#wait-for-events) example in this guide, the `type` property in our `waitForEvent` and `sendEvent` fields must match.
153-
- To send multiple events to a Workflow that has multiple `waitForEvent` calls, call `sendEvent` with the corresponding `type` property set.
153+
- To send multiple events to a Workflow that has multiple `waitForEvent` calls, call `sendEvent` with the corresponding `type` property set (up to 100 characters [^1]).
154154
- Events can also be sent using the REST API (HTTP API)'s [Events endpoint](/api/resources/workflows/subresources/instances/subresources/events/methods/create/).
155155

156156
## TypeScript and type parameters
@@ -202,3 +202,5 @@ export class MyWorkflow extends WorkflowEntrypoint {
202202
```
203203
204204
<Render file="workflows-type-parameters" product="workflows" />
205+
206+
[^1]: Match pattern: `^[a-zA-Z0-9_][a-zA-Z0-9-_]*$`

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ More information about the limits imposed on Workflow can be found in the [Workf
114114

115115
- <code>step.waitForEvent(name: string, options: ): Promise&lt;void&gt;</code>
116116
- `name` - the name of the step.
117-
- `options` - an object with properties for `type`, which determines which event type this `waitForEvent` call will match on when calling `instance.sendEvent`, and an optional `timeout` property, which defines how long the `waitForEvent` call will block for before throwing a timeout exception. The default timeout is 24 hours.
117+
- `options` - an object with properties for `type` (up to 100 characters [^1]), which determines which event type this `waitForEvent` call will match on when calling `instance.sendEvent`, and an optional `timeout` property, which defines how long the `waitForEvent` call will block for before throwing a timeout exception. The default timeout is 24 hours.
118118

119119
<TypeScriptExample>
120120

@@ -444,7 +444,7 @@ Terminate a Workflow instance.
444444
[Send an event](/workflows/build/events-and-parameters/) to a running Workflow instance.
445445

446446
- <code>sendEvent(): Promise&lt;void&gt;</code>
447-
- `options` - the event `type` and `payload` to send to the Workflow instance. The `type` must match the `type` in the corresponding `waitForEvent` call in your Workflow.
447+
- `options` - the event `type` (up to 100 characters [^1]) and `payload` to send to the Workflow instance. The `type` must match the `type` in the corresponding `waitForEvent` call in your Workflow.
448448

449449
Return `void` on success; throws an exception if the Workflow is not running or is an errored state.
450450

0 commit comments

Comments
 (0)