workflow 5.0.0-beta.43 → 5.0.0-beta.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -4
- package/dist/internal/builtins.d.ts +4 -4
- package/dist/internal/builtins.js +6 -6
- package/docs/ai/chat-session-modeling.mdx +23 -24
- package/docs/ai/defining-tools.mdx +5 -6
- package/docs/ai/human-in-the-loop.mdx +11 -11
- package/docs/ai/index.mdx +20 -20
- package/docs/ai/message-queueing.mdx +6 -6
- package/docs/ai/meta.json +1 -0
- package/docs/ai/resumable-streams.mdx +28 -28
- package/docs/ai/sleep-and-delays.mdx +9 -9
- package/docs/ai/streaming-updates-from-tools.mdx +4 -4
- package/docs/api-reference/vitest/index.mdx +8 -8
- package/docs/api-reference/workflow/create-hook.mdx +15 -15
- package/docs/api-reference/workflow/create-webhook.mdx +15 -15
- package/docs/api-reference/workflow/define-hook.mdx +10 -10
- package/docs/api-reference/workflow/fatal-error.mdx +2 -2
- package/docs/api-reference/workflow/fetch.mdx +7 -7
- package/docs/api-reference/workflow/get-step-metadata.mdx +2 -2
- package/docs/api-reference/workflow/get-workflow-metadata.mdx +3 -3
- package/docs/api-reference/workflow/get-writable.mdx +7 -7
- package/docs/api-reference/workflow/index.mdx +1 -1
- package/docs/api-reference/workflow/retryable-error.mdx +1 -1
- package/docs/api-reference/workflow/set-attributes.mdx +2 -2
- package/docs/api-reference/workflow/sleep.mdx +3 -3
- package/docs/api-reference/workflow-ai/durable-agent.mdx +42 -42
- package/docs/api-reference/workflow-ai/index.mdx +3 -3
- package/docs/api-reference/workflow-ai/workflow-chat-transport.mdx +28 -28
- package/docs/api-reference/workflow-api/get-hook-by-token.mdx +11 -11
- package/docs/api-reference/workflow-api/get-run.mdx +10 -10
- package/docs/api-reference/workflow-api/index.mdx +2 -4
- package/docs/api-reference/workflow-api/resume-hook.mdx +14 -14
- package/docs/api-reference/workflow-api/resume-webhook.mdx +3 -3
- package/docs/api-reference/workflow-api/start.mdx +16 -15
- package/docs/api-reference/workflow-astro/workflow.mdx +3 -3
- package/docs/api-reference/workflow-errors/entity-conflict-error.mdx +4 -4
- package/docs/api-reference/workflow-errors/hook-conflict-error.mdx +4 -4
- package/docs/api-reference/workflow-errors/hook-not-found-error.mdx +8 -8
- package/docs/api-reference/workflow-errors/index.mdx +6 -6
- package/docs/api-reference/workflow-errors/precondition-failed-error.mdx +9 -9
- package/docs/api-reference/workflow-errors/run-expired-error.mdx +2 -2
- package/docs/api-reference/workflow-errors/run-not-supported-error.mdx +4 -4
- package/docs/api-reference/workflow-errors/step-not-registered-error.mdx +5 -5
- package/docs/api-reference/workflow-errors/throttle-error.mdx +2 -2
- package/docs/api-reference/workflow-errors/too-early-error.mdx +2 -2
- package/docs/api-reference/workflow-errors/workflow-error.mdx +4 -4
- package/docs/api-reference/workflow-errors/workflow-not-registered-error.mdx +5 -6
- package/docs/api-reference/workflow-errors/workflow-run-cancelled-error.mdx +6 -6
- package/docs/api-reference/workflow-errors/workflow-run-failed-error.mdx +5 -5
- package/docs/api-reference/workflow-errors/workflow-run-not-completed-error.mdx +4 -4
- package/docs/api-reference/workflow-errors/workflow-run-not-found-error.mdx +4 -4
- package/docs/api-reference/workflow-errors/workflow-runtime-error.mdx +2 -2
- package/docs/api-reference/workflow-errors/workflow-world-error.mdx +8 -8
- package/docs/api-reference/workflow-globals.mdx +12 -11
- package/docs/api-reference/workflow-nest/configure-workflow-controller.mdx +2 -2
- package/docs/api-reference/workflow-nest/nest-local-builder.mdx +4 -4
- package/docs/api-reference/workflow-nest/workflow-controller.mdx +1 -1
- package/docs/api-reference/workflow-nest/workflow-module.mdx +4 -4
- package/docs/api-reference/workflow-next/with-workflow.mdx +16 -16
- package/docs/api-reference/workflow-nitro/index.mdx +6 -6
- package/docs/api-reference/workflow-nuxt/index.mdx +4 -4
- package/docs/api-reference/workflow-observability/hydrate-data.mdx +5 -5
- package/docs/api-reference/workflow-observability/hydrate-resource-io.mdx +4 -4
- package/docs/api-reference/workflow-observability/index.mdx +6 -8
- package/docs/api-reference/workflow-observability/observability-revivers.mdx +2 -2
- package/docs/api-reference/workflow-observability/parse-class-name.mdx +3 -3
- package/docs/api-reference/workflow-observability/parse-step-name.mdx +4 -4
- package/docs/api-reference/workflow-observability/parse-workflow-name.mdx +4 -4
- package/docs/api-reference/workflow-runtime/create-world.mdx +8 -8
- package/docs/api-reference/workflow-runtime/get-world-handlers.mdx +6 -6
- package/docs/api-reference/workflow-runtime/get-world.mdx +4 -4
- package/docs/api-reference/workflow-runtime/health-check.mdx +1 -1
- package/docs/api-reference/workflow-runtime/index.mdx +2 -4
- package/docs/api-reference/workflow-runtime/set-world.mdx +15 -13
- package/docs/api-reference/workflow-runtime/workflow-entrypoint.mdx +6 -5
- package/docs/api-reference/workflow-runtime/world/analytics.mdx +9 -9
- package/docs/api-reference/workflow-runtime/world/index.mdx +5 -3
- package/docs/api-reference/workflow-runtime/world/queue.mdx +11 -11
- package/docs/api-reference/workflow-runtime/world/storage.mdx +62 -28
- package/docs/api-reference/workflow-runtime/world/streams.mdx +7 -7
- package/docs/api-reference/workflow-serde/index.mdx +1 -1
- package/docs/api-reference/workflow-serde/workflow-deserialize.mdx +2 -2
- package/docs/api-reference/workflow-serde/workflow-serialize.mdx +7 -7
- package/docs/api-reference/workflow-sveltekit/workflow-plugin.mdx +3 -3
- package/docs/api-reference/workflow-vite/workflow.mdx +5 -5
- package/docs/changelog/attributes-mvp.mdx +39 -39
- package/docs/changelog/batched-event-writes.mdx +12 -12
- package/docs/changelog/eager-processing.mdx +63 -63
- package/docs/changelog/index.mdx +3 -3
- package/docs/changelog/lazy-event-creation.md +27 -27
- package/docs/changelog/resilient-resume.mdx +5 -5
- package/docs/changelog/resilient-start.mdx +14 -14
- package/docs/changelog/step-message-ownership.mdx +47 -47
- package/docs/changelog/turbo-mode.md +20 -20
- package/docs/comparisons/index.mdx +13 -13
- package/docs/comparisons/workflow-sdk-vs-aws-agentcore.mdx +15 -15
- package/docs/comparisons/workflow-sdk-vs-aws-step-functions.mdx +12 -12
- package/docs/comparisons/workflow-sdk-vs-cloudflare-workflows.mdx +11 -11
- package/docs/comparisons/workflow-sdk-vs-inngest.mdx +19 -19
- package/docs/comparisons/workflow-sdk-vs-temporal.mdx +23 -23
- package/docs/comparisons/workflow-sdk-vs-trigger-dev.mdx +18 -17
- package/docs/configuration/build-and-diagnostics.mdx +5 -5
- package/docs/configuration/cli-and-web-ui.mdx +4 -4
- package/docs/configuration/runtime-tuning.mdx +86 -23
- package/docs/configuration/worlds.mdx +28 -14
- package/docs/cookbook/advanced/child-workflows.mdx +25 -25
- package/docs/cookbook/advanced/publishing-libraries.mdx +40 -40
- package/docs/cookbook/advanced/serializable-steps.mdx +21 -21
- package/docs/cookbook/advanced/upgrading-workflows.mdx +31 -31
- package/docs/cookbook/agent-patterns/agent-cancellation.mdx +20 -20
- package/docs/cookbook/agent-patterns/human-in-the-loop.mdx +22 -22
- package/docs/cookbook/common-patterns/batching.mdx +14 -14
- package/docs/cookbook/common-patterns/idempotency.mdx +9 -9
- package/docs/cookbook/common-patterns/rate-limiting.mdx +3 -3
- package/docs/cookbook/common-patterns/saga.mdx +19 -19
- package/docs/cookbook/common-patterns/scheduling.mdx +23 -23
- package/docs/cookbook/common-patterns/sequential-and-parallel.mdx +26 -26
- package/docs/cookbook/common-patterns/timeouts.mdx +23 -23
- package/docs/cookbook/common-patterns/webhooks.mdx +6 -6
- package/docs/cookbook/common-patterns/workflow-composition.mdx +19 -19
- package/docs/cookbook/index.mdx +22 -22
- package/docs/cookbook/integrations/ai-sdk.mdx +43 -41
- package/docs/cookbook/integrations/chat-sdk.mdx +34 -34
- package/docs/cookbook/integrations/sandbox.mdx +46 -46
- package/docs/deploying.mdx +15 -15
- package/docs/errors/abort-signal-timeout-in-workflow.mdx +12 -12
- package/docs/errors/corrupted-event-log.mdx +11 -11
- package/docs/errors/deployment-mismatch.mdx +14 -14
- package/docs/errors/fetch-in-workflow.mdx +8 -8
- package/docs/errors/hook-conflict.mdx +11 -11
- package/docs/errors/index.mdx +1 -1
- package/docs/errors/node-js-module-in-workflow.mdx +5 -5
- package/docs/errors/replay-divergence.mdx +2 -2
- package/docs/errors/runtime-decryption-failed.mdx +12 -12
- package/docs/errors/serialization-failed.mdx +40 -12
- package/docs/errors/start-invalid-workflow-function.mdx +5 -5
- package/docs/errors/step-executed-multiple-times.mdx +2 -2
- package/docs/errors/step-not-registered.mdx +5 -5
- package/docs/errors/timeout-in-workflow.mdx +8 -8
- package/docs/errors/webhook-invalid-respond-with-value.mdx +18 -18
- package/docs/errors/webhook-response-not-sent.mdx +16 -16
- package/docs/errors/workflow-not-registered.mdx +5 -5
- package/docs/foundations/cancellation.mdx +31 -31
- package/docs/foundations/errors-and-retries.mdx +42 -11
- package/docs/foundations/hooks.mdx +35 -35
- package/docs/foundations/idempotency.mdx +9 -9
- package/docs/foundations/serialization.mdx +21 -22
- package/docs/foundations/starting-workflows.mdx +36 -37
- package/docs/foundations/streaming.mdx +46 -41
- package/docs/foundations/versioning.mdx +3 -3
- package/docs/foundations/workflows-and-steps.mdx +9 -9
- package/docs/getting-started/astro.mdx +16 -16
- package/docs/getting-started/express.mdx +8 -8
- package/docs/getting-started/fastify.mdx +8 -8
- package/docs/getting-started/hono.mdx +8 -8
- package/docs/getting-started/nestjs.mdx +18 -17
- package/docs/getting-started/next.mdx +11 -11
- package/docs/getting-started/nitro.mdx +16 -16
- package/docs/getting-started/nuxt.mdx +8 -8
- package/docs/getting-started/python.mdx +4 -4
- package/docs/getting-started/react-router/v7.mdx +1 -1
- package/docs/getting-started/react-router/v8.mdx +1 -1
- package/docs/getting-started/sveltekit.mdx +14 -14
- package/docs/getting-started/tanstack-start.mdx +12 -12
- package/docs/getting-started/vite.mdx +8 -8
- package/docs/how-it-works/cancellation.mdx +62 -62
- package/docs/how-it-works/code-transform.mdx +66 -54
- package/docs/how-it-works/encryption.mdx +25 -21
- package/docs/how-it-works/event-sourcing.mdx +53 -35
- package/docs/how-it-works/framework-integrations.mdx +12 -12
- package/docs/how-it-works/understanding-directives.mdx +21 -21
- package/docs/internal/index.mdx +6 -6
- package/docs/internal/nitro-native-build.mdx +2 -2
- package/docs/internal/nitro-web-ui.mdx +4 -4
- package/docs/internal/serializable-abort-controller.mdx +7 -7
- package/docs/observability/attributes.mdx +3 -3
- package/docs/observability/index.mdx +14 -10
- package/docs/observability/tracing.mdx +10 -10
- package/docs/testing/index.mdx +33 -33
- package/docs/testing/server-based.mdx +10 -10
- package/docs/whats-new.mdx +185 -0
- package/package.json +12 -12
|
@@ -15,19 +15,19 @@ related:
|
|
|
15
15
|
|
|
16
16
|
This error occurs when you try to import or use Node.js core modules (like `fs`, `http`, `crypto`, `path`, etc.) directly inside a workflow function.
|
|
17
17
|
|
|
18
|
-
## Error
|
|
18
|
+
## Error message
|
|
19
19
|
|
|
20
|
-
```
|
|
20
|
+
```text
|
|
21
21
|
Cannot use Node.js module "fs" in workflow functions. Move this module to a step function.
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
## Why
|
|
24
|
+
## Why this happens
|
|
25
25
|
|
|
26
26
|
Workflow functions run in a sandboxed environment without full Node.js runtime access. This restriction is important for maintaining **determinism** - the ability to replay workflows exactly and resume from where they left off after suspensions or failures.
|
|
27
27
|
|
|
28
28
|
Node.js modules have side effects and non-deterministic behavior that could break workflow replay guarantees.
|
|
29
29
|
|
|
30
|
-
## Quick
|
|
30
|
+
## Quick fix
|
|
31
31
|
|
|
32
32
|
Move any code using Node.js modules to a step function. Step functions have full Node.js runtime access.
|
|
33
33
|
|
|
@@ -68,7 +68,7 @@ async function read(filePath: string) {
|
|
|
68
68
|
}
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
-
## Common Node.js
|
|
71
|
+
## Common Node.js modules
|
|
72
72
|
|
|
73
73
|
These common Node.js core modules cannot be used in workflow functions:
|
|
74
74
|
|
|
@@ -14,7 +14,7 @@ A replay divergence occurs when one invocation of a workflow cannot consume the
|
|
|
14
14
|
|
|
15
15
|
This is an SDK/runtime signal, not an error thrown by your workflow code. It is not catchable inside a workflow function.
|
|
16
16
|
|
|
17
|
-
## Automatic
|
|
17
|
+
## Automatic recovery
|
|
18
18
|
|
|
19
19
|
A single divergent replay does not prove that persisted history is corrupted. For example, asynchronous delivery ordering may cause one invocation to follow the wrong side of a race while another replay can follow the recorded history correctly.
|
|
20
20
|
|
|
@@ -22,6 +22,6 @@ The runtime automatically queues another replay when an invocation reports `REPL
|
|
|
22
22
|
|
|
23
23
|
If recovery replays continue to diverge after the recovery budget is exhausted, the runtime marks the run as failed with `CORRUPTED_EVENT_LOG` and records the latest divergent event for diagnosis.
|
|
24
24
|
|
|
25
|
-
## What
|
|
25
|
+
## What to do
|
|
26
26
|
|
|
27
27
|
Most replay divergence signals recover without action. If a run ultimately fails with `CORRUPTED_EVENT_LOG`, update to the latest `workflow` package and report the run ID and error details if the failure persists.
|
|
@@ -11,33 +11,33 @@ related:
|
|
|
11
11
|
|
|
12
12
|
This error occurs when the Workflow SDK's built-in AES-GCM encryption layer fails while encrypting or decrypting a workflow payload. The SDK encrypts step inputs, step outputs, hook payloads, and other event-log data with a per-run AES-256 key whenever encryption is configured for the deployment.
|
|
13
13
|
|
|
14
|
-
This is an **internal SDK failure
|
|
14
|
+
This is an **internal SDK failure**: your workflow code never invokes the encryption primitives directly. When this surfaces, the ciphertext, nonce, or authentication tag the SDK tried to verify does not match the bytes that were originally produced. The run fails with the `RUNTIME_ERROR` classification.
|
|
15
15
|
|
|
16
|
-
## Error
|
|
16
|
+
## Error message
|
|
17
17
|
|
|
18
|
-
```
|
|
18
|
+
```text
|
|
19
19
|
AES-256-GCM decryption failed: The operation failed for an operation-specific reason
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
The underlying cause is a native Web Crypto [`OperationError`](https://developer.mozilla.org/en-US/docs/Web/API/DOMException#operationerror)
|
|
22
|
+
The underlying cause is a native Web Crypto [`OperationError`](https://developer.mozilla.org/en-US/docs/Web/API/DOMException#operationerror), most commonly raised by `AESCipherJob.onDone` in Node's `node:internal/crypto/util` module when the GCM authentication tag does not verify.
|
|
23
23
|
|
|
24
24
|
The thrown `RuntimeDecryptionError` carries a small `context` object with diagnostic fields to help triangulate the source:
|
|
25
25
|
|
|
26
|
-
- `operation
|
|
27
|
-
- `byteLength
|
|
28
|
-
- `formatPrefix
|
|
26
|
+
- `operation`: `'encrypt'` or `'decrypt'`
|
|
27
|
+
- `byteLength`: total byte length of the payload at the failure site
|
|
28
|
+
- `formatPrefix`: the first 4 bytes of the input (`'encr'` for a well-formed encrypted envelope, otherwise a hex dump)
|
|
29
29
|
|
|
30
|
-
## Why
|
|
30
|
+
## Why this happens
|
|
31
31
|
|
|
32
32
|
Common causes, in rough order of likelihood:
|
|
33
33
|
|
|
34
34
|
1. **Ciphertext mutation or truncation in transit.** The encrypted payload reached the SDK with bytes that differ from what storage holds. Possible sources include a truncated HTTP response from a workflow-server ref endpoint, an edge-cache miss returning a partial 200, or a proxy drop during streaming. A truncated body whose first 4 bytes happen to still spell `encr` produces the exact "auth tag mismatch" symptom.
|
|
35
|
-
2. **Key resolution mismatch.** The key used to decrypt is not the key that was used to encrypt
|
|
35
|
+
2. **Key resolution mismatch.** The key used to decrypt is not the key that was used to encrypt, e.g. the run's `deploymentId` was not threaded through key resolution and the SDK fell back to the wrong deployment's key material.
|
|
36
36
|
3. **Malformed encrypted envelope.** The envelope is too short to contain the GCM nonce (12 bytes) and auth tag (16 bytes), so decryption is rejected before it begins.
|
|
37
37
|
|
|
38
|
-
## What
|
|
38
|
+
## What to do
|
|
39
39
|
|
|
40
|
-
This error indicates an SDK or infrastructure problem
|
|
40
|
+
This error indicates an SDK or infrastructure problem, not a bug in your workflow code. Your workflow code does not need to change.
|
|
41
41
|
|
|
42
42
|
### 1. Upgrade to the latest `workflow` package
|
|
43
43
|
|
|
@@ -60,7 +60,7 @@ If the error persists after upgrading, please [open an issue on GitHub](https://
|
|
|
60
60
|
- The full error message, including the `context` fields (`operation`, `byteLength`, `formatPrefix`)
|
|
61
61
|
- Whether the affected workflows make heavy use of large step inputs/outputs (which may indicate the failure is on the lazy-loaded ref read path)
|
|
62
62
|
|
|
63
|
-
## This
|
|
63
|
+
## This error cannot be caught
|
|
64
64
|
|
|
65
65
|
Like other `WorkflowRuntimeError` subclasses, a runtime decryption failure is **not catchable** inside your workflow function. The runtime cannot safely continue executing user code when an event-log payload can't be verified, so the entire run fails immediately and is marked as `failed`.
|
|
66
66
|
|
|
@@ -15,9 +15,9 @@ related:
|
|
|
15
15
|
|
|
16
16
|
This error occurs when you try to pass non-serializable data between execution boundaries in your workflow. All data passed between workflow functions, step functions, and the workflow runtime must be serializable to persist in the event log.
|
|
17
17
|
|
|
18
|
-
## Error
|
|
18
|
+
## Error message
|
|
19
19
|
|
|
20
|
-
```
|
|
20
|
+
```text
|
|
21
21
|
Failed to serialize workflow arguments. Ensure you're passing serializable types
|
|
22
22
|
(plain objects, arrays, primitives, Date, RegExp, Map, Set).
|
|
23
23
|
```
|
|
@@ -29,7 +29,35 @@ This error can appear when:
|
|
|
29
29
|
- Serializing step arguments
|
|
30
30
|
- Serializing step return values
|
|
31
31
|
|
|
32
|
-
##
|
|
32
|
+
## Where the error surfaces
|
|
33
|
+
|
|
34
|
+
Where you observe the failure depends on which boundary it crosses:
|
|
35
|
+
|
|
36
|
+
- **Workflow arguments**: `start()` throws synchronously in your application code.
|
|
37
|
+
- **Step arguments and step return values**: the *step* fails with the `SerializationError`, exactly like a step whose body threw a fatal error: no retries (the failure is deterministic), and a `try/catch` around the step call in your workflow code observes it. The step's recorded input shows `[input unavailable: step argument serialization failed]` when the arguments were the unserializable part.
|
|
38
|
+
- **Workflow return values**: the workflow body has already returned, so nothing can catch it; the run fails.
|
|
39
|
+
|
|
40
|
+
```typescript lineNumbers
|
|
41
|
+
async function stepWithBadArguments(value: unknown) {
|
|
42
|
+
"use step";
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export async function processWorkflow(someValue: unknown) {
|
|
47
|
+
"use workflow";
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
await stepWithBadArguments(someValue);
|
|
51
|
+
} catch (err) {
|
|
52
|
+
// err.name === "SerializationError"
|
|
53
|
+
// "Failed to serialize step arguments at path ..."
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Uncaught, the error propagates out of the workflow body and the run fails immediately with the error code `USER_ERROR`; it does not retry.
|
|
59
|
+
|
|
60
|
+
## Why this happens
|
|
33
61
|
|
|
34
62
|
Workflows persist their state using an event log. Every value that crosses execution boundaries must be:
|
|
35
63
|
|
|
@@ -38,9 +66,9 @@ Workflows persist their state using an event log. Every value that crosses execu
|
|
|
38
66
|
|
|
39
67
|
Functions, class instances, symbols, and other non-serializable types cannot be properly reconstructed after serialization, which would break workflow replay.
|
|
40
68
|
|
|
41
|
-
## Common
|
|
69
|
+
## Common causes
|
|
42
70
|
|
|
43
|
-
### Passing
|
|
71
|
+
### Passing functions
|
|
44
72
|
|
|
45
73
|
{/* @skip-typecheck: incomplete code sample */}
|
|
46
74
|
```typescript lineNumbers
|
|
@@ -72,7 +100,7 @@ async function processStep(config: { shouldLog: boolean }) {
|
|
|
72
100
|
}
|
|
73
101
|
```
|
|
74
102
|
|
|
75
|
-
### Class
|
|
103
|
+
### Class instances
|
|
76
104
|
|
|
77
105
|
```typescript lineNumbers
|
|
78
106
|
class User {
|
|
@@ -111,11 +139,11 @@ async function greetStep(userData: { name: string }) {
|
|
|
111
139
|
}
|
|
112
140
|
```
|
|
113
141
|
|
|
114
|
-
## Supported
|
|
142
|
+
## Supported serializable types
|
|
115
143
|
|
|
116
144
|
Workflow SDK supports these types across execution boundaries:
|
|
117
145
|
|
|
118
|
-
### Standard JSON
|
|
146
|
+
### Standard JSON types
|
|
119
147
|
|
|
120
148
|
- `string`, `number`, `boolean`, `null`
|
|
121
149
|
- Arrays of serializable values
|
|
@@ -123,10 +151,10 @@ Workflow SDK supports these types across execution boundaries:
|
|
|
123
151
|
|
|
124
152
|
To learn more about supported types, see the [Serialization](/docs/foundations/serialization) section.
|
|
125
153
|
|
|
126
|
-
## Debugging
|
|
154
|
+
## Debugging serialization issues
|
|
127
155
|
|
|
128
156
|
To identify what's causing serialization to fail:
|
|
129
157
|
|
|
130
|
-
1. **Check the error stack trace
|
|
131
|
-
2. **Simplify your data
|
|
132
|
-
3. **
|
|
158
|
+
1. **Check the error stack trace**: It often shows which property failed.
|
|
159
|
+
2. **Simplify your data**: Temporarily pass smaller objects to isolate the issue.
|
|
160
|
+
3. **Use supported data types**: See [Serialization](/docs/foundations/serialization) for details.
|
|
@@ -17,17 +17,17 @@ related:
|
|
|
17
17
|
|
|
18
18
|
This error occurs when `start()` receives a function that does not have Workflow SDK's generated workflow metadata. In practice, that usually means the function is missing `"use workflow"` or the file was never transformed by your framework integration.
|
|
19
19
|
|
|
20
|
-
## Error
|
|
20
|
+
## Error message
|
|
21
21
|
|
|
22
|
-
```
|
|
22
|
+
```text
|
|
23
23
|
'start' received an invalid workflow function. Ensure the Workflow SDK is configured correctly and the function includes a 'use workflow' directive.
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
## Why
|
|
26
|
+
## Why this happens
|
|
27
27
|
|
|
28
|
-
`start()` expects an imported workflow function
|
|
28
|
+
`start()` expects an imported workflow function rather than any async function. During compilation, Workflow SDK transforms files that contain `"use workflow"` and attaches generated metadata such as the workflow ID. If that transform never runs, or if you pass a wrapper function instead of the transformed export, `start()` cannot identify what to enqueue and throws this error.
|
|
29
29
|
|
|
30
|
-
## Common
|
|
30
|
+
## Common causes
|
|
31
31
|
|
|
32
32
|
### Missing `"use workflow"`
|
|
33
33
|
|
|
@@ -12,12 +12,12 @@ related:
|
|
|
12
12
|
|
|
13
13
|
There may be cases where you see multiple `step_started` events for the same step in a workflow run. This happens if the function invocation executing the step crashes unexpectedly, and the step can not report the error. The step will be re-tried according to your retry policy in this case, but no error will be visible in the [Observability UI](/docs/observability).
|
|
14
14
|
|
|
15
|
-
## Common
|
|
15
|
+
## Common causes
|
|
16
16
|
|
|
17
17
|
- **Function timeouts**: if your step code runs longer than the configured maximum function duration, it will be killed. Compare the gap between the `step_started` events to your configured function duration to be sure.
|
|
18
18
|
- **Out of memory (OOM)**: if your step code loads enough data into memory, especially if the step is invoked concurrently, the function invocation might run out of memory. You can see your function's peak memory use by going to the [Observability Query page](https://vercel.com/docs/observability) and showing the **Function Invocation Peak Memory** metric, then filtering down the **Route** to `/.well-known/workflow` endpoints.
|
|
19
19
|
- **Network issues**: persistent firewall, network stability, and related issues might prevent your function from reporting results or errors. This should be temporary.
|
|
20
20
|
|
|
21
|
-
## Getting
|
|
21
|
+
## Getting help
|
|
22
22
|
|
|
23
23
|
If you consistently see multiple `step_started` events and have ruled out function timeouts, OOMs, and firewall issues, please [contact support](https://vercel.com/help).
|
|
@@ -12,21 +12,21 @@ related:
|
|
|
12
12
|
|
|
13
13
|
This error occurs when the Workflow runtime tries to execute a step function that is not registered in the current deployment. When this happens, the step fails (like a `FatalError`) and control is passed back to the workflow function, which can optionally handle the failure.
|
|
14
14
|
|
|
15
|
-
## Error
|
|
15
|
+
## Error message
|
|
16
16
|
|
|
17
|
-
```
|
|
17
|
+
```text
|
|
18
18
|
Step "<stepName>" is not registered in the current deployment.
|
|
19
19
|
This usually indicates a build or bundling issue that caused the step
|
|
20
20
|
to not be included in the deployment.
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
## Why
|
|
23
|
+
## Why this happens
|
|
24
24
|
|
|
25
25
|
Workflow runs are pegged to a specific deployment, so this error is not caused by newer deployments overriding the running code. Instead, it means the step function was not included in the deployment's workflow bundle at build time.
|
|
26
26
|
|
|
27
27
|
This is an **infrastructure error**, not a user code error.
|
|
28
28
|
|
|
29
|
-
## Common
|
|
29
|
+
## Common causes
|
|
30
30
|
|
|
31
31
|
### Build tooling issue
|
|
32
32
|
|
|
@@ -40,7 +40,7 @@ Something went wrong during the build process that caused the step function to n
|
|
|
40
40
|
|
|
41
41
|
The step function was deleted or its `"use step"` directive was removed, but the workflow still references it. Ensure all steps referenced by your workflow are present in the codebase.
|
|
42
42
|
|
|
43
|
-
## How to
|
|
43
|
+
## How to resolve
|
|
44
44
|
|
|
45
45
|
1. **Check your build logs:** Look for errors or warnings related to workflow bundling. Ensure the step file contains a valid `"use step"` directive and is properly exported.
|
|
46
46
|
|
|
@@ -15,19 +15,19 @@ related:
|
|
|
15
15
|
|
|
16
16
|
This error occurs when you try to use `setTimeout()`, `setInterval()`, or related timing functions directly inside a workflow function.
|
|
17
17
|
|
|
18
|
-
## Error
|
|
18
|
+
## Error message
|
|
19
19
|
|
|
20
|
-
```
|
|
20
|
+
```text
|
|
21
21
|
Timeout functions like "setTimeout" and "setInterval" are not supported in workflow functions. Use the "sleep" function from "workflow" for time-based delays.
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
## Why
|
|
24
|
+
## Why this happens
|
|
25
25
|
|
|
26
26
|
Workflow functions run in a sandboxed environment where timing functions like `setTimeout()` and `setInterval()` are not available. These functions rely on asynchronous scheduling that would break the **deterministic replay** guarantees that workflows depend on.
|
|
27
27
|
|
|
28
28
|
When a workflow suspends and later resumes, it replays from the event log. If timing functions were allowed, the replay would produce different results than the original execution.
|
|
29
29
|
|
|
30
|
-
## Quick
|
|
30
|
+
## Quick fix
|
|
31
31
|
|
|
32
32
|
Use the `sleep` function from the `workflow` package for time-based delays. Unlike `setTimeout()`, `sleep` is tracked in the event log and replays correctly.
|
|
33
33
|
|
|
@@ -59,7 +59,7 @@ export async function delayedWorkflow() {
|
|
|
59
59
|
}
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
-
## Unavailable
|
|
62
|
+
## Unavailable functions
|
|
63
63
|
|
|
64
64
|
These timing functions cannot be used in workflow functions:
|
|
65
65
|
|
|
@@ -70,9 +70,9 @@ These timing functions cannot be used in workflow functions:
|
|
|
70
70
|
- `clearInterval()`
|
|
71
71
|
- `clearImmediate()`
|
|
72
72
|
|
|
73
|
-
## Common
|
|
73
|
+
## Common scenarios
|
|
74
74
|
|
|
75
|
-
### Polling with
|
|
75
|
+
### Polling with delays
|
|
76
76
|
|
|
77
77
|
If you need to poll an external service with delays between requests:
|
|
78
78
|
|
|
@@ -102,7 +102,7 @@ async function checkStatus() {
|
|
|
102
102
|
}
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
-
### Scheduled
|
|
105
|
+
### Scheduled delays
|
|
106
106
|
|
|
107
107
|
For workflows that need to wait for a specific duration:
|
|
108
108
|
|
|
@@ -11,13 +11,13 @@ related:
|
|
|
11
11
|
|
|
12
12
|
This error occurs when you provide an invalid value for the `respondWith` option when creating a webhook. The `respondWith` option must be either `"manual"` or a `Response` object.
|
|
13
13
|
|
|
14
|
-
## Error
|
|
14
|
+
## Error message
|
|
15
15
|
|
|
16
|
-
```
|
|
16
|
+
```text
|
|
17
17
|
Invalid `respondWith` value: [value]
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
## Why
|
|
20
|
+
## Why this happens
|
|
21
21
|
|
|
22
22
|
When creating a webhook with `createWebhook()`, you can specify how the webhook should respond to incoming HTTP requests using the `respondWith` option. This option only accepts specific values:
|
|
23
23
|
|
|
@@ -25,16 +25,16 @@ When creating a webhook with `createWebhook()`, you can specify how the webhook
|
|
|
25
25
|
2. A `Response` object - A pre-defined response to send immediately
|
|
26
26
|
3. `undefined` (default) - Returns a `202 Accepted` response
|
|
27
27
|
|
|
28
|
-
## Common
|
|
28
|
+
## Common causes
|
|
29
29
|
|
|
30
|
-
### Using an
|
|
30
|
+
### Using an invalid string value
|
|
31
31
|
|
|
32
32
|
```typescript lineNumbers
|
|
33
33
|
// Error - invalid string value
|
|
34
34
|
export async function webhookWorkflow() {
|
|
35
35
|
"use workflow";
|
|
36
36
|
|
|
37
|
-
const webhook =
|
|
37
|
+
const webhook = createWebhook({
|
|
38
38
|
respondWith: "automatic", // Error! // [!code highlight]
|
|
39
39
|
});
|
|
40
40
|
}
|
|
@@ -49,7 +49,7 @@ import { createWebhook } from "workflow";
|
|
|
49
49
|
export async function webhookWorkflow() {
|
|
50
50
|
"use workflow";
|
|
51
51
|
|
|
52
|
-
const webhook =
|
|
52
|
+
const webhook = createWebhook({
|
|
53
53
|
respondWith: "manual", // [!code highlight]
|
|
54
54
|
});
|
|
55
55
|
|
|
@@ -60,14 +60,14 @@ export async function webhookWorkflow() {
|
|
|
60
60
|
}
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
### Using a
|
|
63
|
+
### Using a non-Response object
|
|
64
64
|
|
|
65
65
|
```typescript lineNumbers
|
|
66
66
|
// Error - plain object instead of Response
|
|
67
67
|
export async function webhookWorkflow() {
|
|
68
68
|
"use workflow";
|
|
69
69
|
|
|
70
|
-
const webhook =
|
|
70
|
+
const webhook = createWebhook({
|
|
71
71
|
respondWith: { status: 200, body: "OK" }, // Error! // [!code highlight]
|
|
72
72
|
});
|
|
73
73
|
}
|
|
@@ -82,32 +82,32 @@ import { createWebhook } from "workflow";
|
|
|
82
82
|
export async function webhookWorkflow() {
|
|
83
83
|
"use workflow";
|
|
84
84
|
|
|
85
|
-
const webhook =
|
|
85
|
+
const webhook = createWebhook({
|
|
86
86
|
respondWith: new Response("OK", { status: 200 }), // [!code highlight]
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
-
## Valid
|
|
91
|
+
## Valid usage examples
|
|
92
92
|
|
|
93
|
-
### Default
|
|
93
|
+
### Default behavior (202 response)
|
|
94
94
|
|
|
95
95
|
```typescript lineNumbers
|
|
96
96
|
import { createWebhook } from "workflow";
|
|
97
97
|
|
|
98
98
|
// Returns 202 Accepted automatically
|
|
99
|
-
const webhook =
|
|
99
|
+
const webhook = createWebhook();
|
|
100
100
|
const request = await webhook;
|
|
101
101
|
// No need to send a response
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
-
### Manual
|
|
104
|
+
### Manual response
|
|
105
105
|
|
|
106
106
|
```typescript lineNumbers
|
|
107
107
|
import { createWebhook } from "workflow";
|
|
108
108
|
|
|
109
109
|
// Manual response control
|
|
110
|
-
const webhook =
|
|
110
|
+
const webhook = createWebhook({
|
|
111
111
|
respondWith: "manual",
|
|
112
112
|
});
|
|
113
113
|
|
|
@@ -125,13 +125,13 @@ await request.respondWith(
|
|
|
125
125
|
);
|
|
126
126
|
```
|
|
127
127
|
|
|
128
|
-
### Pre-defined
|
|
128
|
+
### Pre-defined response
|
|
129
129
|
|
|
130
130
|
```typescript lineNumbers
|
|
131
131
|
import { createWebhook } from "workflow";
|
|
132
132
|
|
|
133
133
|
// Immediate response
|
|
134
|
-
const webhook =
|
|
134
|
+
const webhook = createWebhook({
|
|
135
135
|
respondWith: new Response("Request received", { status: 200 }),
|
|
136
136
|
});
|
|
137
137
|
|
|
@@ -139,7 +139,7 @@ const request = await webhook;
|
|
|
139
139
|
// Response already sent
|
|
140
140
|
```
|
|
141
141
|
|
|
142
|
-
## Learn
|
|
142
|
+
## Learn more
|
|
143
143
|
|
|
144
144
|
- [createWebhook() API Reference](/docs/api-reference/workflow/create-webhook)
|
|
145
145
|
- [resumeWebhook() API Reference](/docs/api-reference/workflow-api/resume-webhook)
|
|
@@ -15,28 +15,28 @@ related:
|
|
|
15
15
|
|
|
16
16
|
This error occurs when a webhook is configured with `respondWith: "manual"` but the workflow does not send a response using `request.respondWith()` before the webhook execution completes.
|
|
17
17
|
|
|
18
|
-
## Error
|
|
18
|
+
## Error message
|
|
19
19
|
|
|
20
|
-
```
|
|
20
|
+
```text
|
|
21
21
|
Workflow run did not send a response
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
## Why
|
|
24
|
+
## Why this happens
|
|
25
25
|
|
|
26
26
|
When you create a webhook with `respondWith: "manual"`, you are responsible for calling `request.respondWith()` to send the HTTP response back to the caller. If the workflow execution completes without sending a response, this error will be thrown.
|
|
27
27
|
|
|
28
28
|
The webhook infrastructure waits for a response to be sent, and if none is provided, it cannot complete the HTTP request properly.
|
|
29
29
|
|
|
30
|
-
## Common
|
|
30
|
+
## Common causes
|
|
31
31
|
|
|
32
|
-
### Forgetting to
|
|
32
|
+
### Forgetting to call `request.respondWith()`
|
|
33
33
|
|
|
34
34
|
```typescript lineNumbers
|
|
35
35
|
// Error - no response sent
|
|
36
36
|
export async function webhookWorkflow() {
|
|
37
37
|
"use workflow";
|
|
38
38
|
|
|
39
|
-
const webhook =
|
|
39
|
+
const webhook = createWebhook({
|
|
40
40
|
respondWith: "manual",
|
|
41
41
|
});
|
|
42
42
|
|
|
@@ -59,7 +59,7 @@ import { createWebhook } from "workflow";
|
|
|
59
59
|
export async function webhookWorkflow() {
|
|
60
60
|
"use workflow";
|
|
61
61
|
|
|
62
|
-
const webhook =
|
|
62
|
+
const webhook = createWebhook({
|
|
63
63
|
respondWith: "manual",
|
|
64
64
|
});
|
|
65
65
|
|
|
@@ -74,14 +74,14 @@ export async function webhookWorkflow() {
|
|
|
74
74
|
}
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
### Conditional
|
|
77
|
+
### Conditional response logic
|
|
78
78
|
|
|
79
79
|
```typescript lineNumbers
|
|
80
80
|
// Error - response only sent in some branches
|
|
81
81
|
export async function webhookWorkflow() {
|
|
82
82
|
"use workflow";
|
|
83
83
|
|
|
84
|
-
const webhook =
|
|
84
|
+
const webhook = createWebhook({
|
|
85
85
|
respondWith: "manual",
|
|
86
86
|
});
|
|
87
87
|
|
|
@@ -104,7 +104,7 @@ import { createWebhook } from "workflow";
|
|
|
104
104
|
export async function webhookWorkflow() {
|
|
105
105
|
"use workflow";
|
|
106
106
|
|
|
107
|
-
const webhook =
|
|
107
|
+
const webhook = createWebhook({
|
|
108
108
|
respondWith: "manual",
|
|
109
109
|
});
|
|
110
110
|
|
|
@@ -119,14 +119,14 @@ export async function webhookWorkflow() {
|
|
|
119
119
|
}
|
|
120
120
|
```
|
|
121
121
|
|
|
122
|
-
### Exception
|
|
122
|
+
### Exception before response
|
|
123
123
|
|
|
124
124
|
```typescript lineNumbers
|
|
125
125
|
// Error - exception thrown before response
|
|
126
126
|
export async function webhookWorkflow() {
|
|
127
127
|
"use workflow";
|
|
128
128
|
|
|
129
|
-
const webhook =
|
|
129
|
+
const webhook = createWebhook({
|
|
130
130
|
respondWith: "manual",
|
|
131
131
|
});
|
|
132
132
|
|
|
@@ -149,7 +149,7 @@ import { createWebhook } from "workflow";
|
|
|
149
149
|
export async function webhookWorkflow() {
|
|
150
150
|
"use workflow";
|
|
151
151
|
|
|
152
|
-
const webhook =
|
|
152
|
+
const webhook = createWebhook({
|
|
153
153
|
respondWith: "manual",
|
|
154
154
|
});
|
|
155
155
|
|
|
@@ -168,7 +168,7 @@ export async function webhookWorkflow() {
|
|
|
168
168
|
}
|
|
169
169
|
```
|
|
170
170
|
|
|
171
|
-
## Alternative: Use
|
|
171
|
+
## Alternative: Use default response mode
|
|
172
172
|
|
|
173
173
|
If you don't need custom response control, consider using the default response mode which automatically returns a `202 Accepted` response:
|
|
174
174
|
|
|
@@ -179,7 +179,7 @@ import { createWebhook } from "workflow";
|
|
|
179
179
|
export async function webhookWorkflow() {
|
|
180
180
|
"use workflow";
|
|
181
181
|
|
|
182
|
-
const webhook =
|
|
182
|
+
const webhook = createWebhook(); // [!code highlight]
|
|
183
183
|
const request = await webhook;
|
|
184
184
|
|
|
185
185
|
// Process request asynchronously
|
|
@@ -189,7 +189,7 @@ export async function webhookWorkflow() {
|
|
|
189
189
|
}
|
|
190
190
|
```
|
|
191
191
|
|
|
192
|
-
## Learn
|
|
192
|
+
## Learn more
|
|
193
193
|
|
|
194
194
|
- [createWebhook() API Reference](/docs/api-reference/workflow/create-webhook)
|
|
195
195
|
- [resumeWebhook() API Reference](/docs/api-reference/workflow-api/resume-webhook)
|
|
@@ -12,19 +12,19 @@ related:
|
|
|
12
12
|
|
|
13
13
|
This error occurs when the Workflow runtime tries to execute a workflow function that is not registered in the current deployment. When this happens, the run fails with a `RUNTIME_ERROR` error code.
|
|
14
14
|
|
|
15
|
-
## Error
|
|
15
|
+
## Error message
|
|
16
16
|
|
|
17
|
-
```
|
|
17
|
+
```text
|
|
18
18
|
Workflow "<workflowName>" is not registered in the current deployment.
|
|
19
19
|
This usually means a run was started against a deployment that does not
|
|
20
20
|
have this workflow, or there was a build/bundling issue.
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
## Why
|
|
23
|
+
## Why this happens
|
|
24
24
|
|
|
25
25
|
This error means the deployment that received the workflow execution request does not have the specified workflow function in its bundle. This is an **infrastructure error**, not a user code error.
|
|
26
26
|
|
|
27
|
-
## Common
|
|
27
|
+
## Common causes
|
|
28
28
|
|
|
29
29
|
### Run started against a deployment without the workflow
|
|
30
30
|
|
|
@@ -57,7 +57,7 @@ Something went wrong during the build process that caused the workflow function
|
|
|
57
57
|
- The workflow function is not exported from the workflow file
|
|
58
58
|
- An esbuild or SWC plugin error silently excluded the workflow
|
|
59
59
|
|
|
60
|
-
## How to
|
|
60
|
+
## How to resolve
|
|
61
61
|
|
|
62
62
|
1. **If the workflow was renamed or moved:** Deploy with the workflow restored to its original name and location, then retry the run. Alternatively, start a new run using the updated workflow name against the current deployment.
|
|
63
63
|
|