workflow 4.8.9 → 4.8.10
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/docs/api-reference/workflow-errors/workflow-run-cancelled-error.mdx +7 -0
- package/docs/api-reference/workflow-errors/workflow-run-failed-error.mdx +7 -0
- package/docs/deploying/index.mdx +11 -0
- package/docs/deploying/world/vercel-world.mdx +26 -1
- package/docs/foundations/errors-and-retries.mdx +10 -0
- package/docs/foundations/serialization.mdx +1 -0
- package/package.json +11 -11
|
@@ -12,6 +12,8 @@ related:
|
|
|
12
12
|
|
|
13
13
|
You can check for cancellation before awaiting by inspecting `run.status`.
|
|
14
14
|
|
|
15
|
+
A canceled run is terminal, so this error is non-retryable (`fatal: true`). Inside a workflow, `await run.returnValue` runs as a step, and that step fails on its first attempt instead of spending its retry budget re-reading a run that cannot change. Errors from *failing to read* the run, such as a transport blip, stay retryable.
|
|
16
|
+
|
|
15
17
|
```typescript lineNumbers
|
|
16
18
|
import { WorkflowRunCancelledError } from "workflow/errors"
|
|
17
19
|
declare const run: { status: Promise<string>; returnValue: Promise<any> }; // @setup
|
|
@@ -34,6 +36,11 @@ definition={`
|
|
|
34
36
|
interface WorkflowRunCancelledError {
|
|
35
37
|
/** The ID of the cancelled run. */
|
|
36
38
|
runId: string;
|
|
39
|
+
/**
|
|
40
|
+
* Always \`true\`. A canceled run is terminal, so a step that reads one is
|
|
41
|
+
* not retried.
|
|
42
|
+
*/
|
|
43
|
+
fatal: true;
|
|
37
44
|
/** The error message. */
|
|
38
45
|
message: string;
|
|
39
46
|
}
|
|
@@ -13,6 +13,8 @@ related:
|
|
|
13
13
|
|
|
14
14
|
The `cause` property contains the underlying error with its message, stack trace, and optional error code.
|
|
15
15
|
|
|
16
|
+
A failed run is terminal, so this error is non-retryable (`fatal: true`). Inside a workflow, `await run.returnValue` runs as a step, and that step fails on its first attempt instead of spending its retry budget re-reading a run that cannot change: the remote failure reaches the caller immediately, and the caller catches a `WorkflowRunFailedError` rather than a retry-exhaustion wrapper. Errors from *failing to read* the run, such as a transport blip, stay retryable.
|
|
17
|
+
|
|
16
18
|
```typescript lineNumbers
|
|
17
19
|
import { WorkflowRunFailedError } from "workflow/errors"
|
|
18
20
|
declare const run: { status: Promise<string>; returnValue: Promise<any> }; // @setup
|
|
@@ -40,6 +42,11 @@ interface WorkflowRunFailedError {
|
|
|
40
42
|
runId: string;
|
|
41
43
|
/** The underlying error that caused the failure. */
|
|
42
44
|
cause: Error & { code?: string };
|
|
45
|
+
/**
|
|
46
|
+
* Always \`true\`. A failed run is terminal, so a step that reads one is not
|
|
47
|
+
* retried.
|
|
48
|
+
*/
|
|
49
|
+
fatal: true;
|
|
43
50
|
/** The error message. */
|
|
44
51
|
message: string;
|
|
45
52
|
}
|
package/docs/deploying/index.mdx
CHANGED
|
@@ -51,6 +51,17 @@ vercel deploy
|
|
|
51
51
|
|
|
52
52
|
<FluidComputeCallout />
|
|
53
53
|
|
|
54
|
+
<Callout type="warn">
|
|
55
|
+
**Enable access to System Environment Variables before deploying.** Workflow
|
|
56
|
+
recognizes a Vercel deployment by `VERCEL_DEPLOYMENT_ID`, which Vercel exposes
|
|
57
|
+
to your build and your functions only when the **Enable access to System
|
|
58
|
+
Environment Variables** checkbox is selected under **Settings**, then
|
|
59
|
+
**Environment Variables**, in your project. With it cleared, the deployment
|
|
60
|
+
falls back to the Local World and every run fails on the read-only
|
|
61
|
+
filesystem. See
|
|
62
|
+
[System environment variables](/worlds/vercel#system-environment-variables).
|
|
63
|
+
</Callout>
|
|
64
|
+
|
|
54
65
|
<Callout>
|
|
55
66
|
Learn more about the [Vercel World](/worlds/vercel) and its capabilities.
|
|
56
67
|
</Callout>
|
|
@@ -32,6 +32,31 @@ That's it. Vercel automatically:
|
|
|
32
32
|
|
|
33
33
|
<FluidComputeCallout />
|
|
34
34
|
|
|
35
|
+
## System environment variables
|
|
36
|
+
|
|
37
|
+
Workflow recognizes a Vercel deployment by `VERCEL_DEPLOYMENT_ID`. Vercel exposes that variable, along with the rest of its [system environment variables](https://vercel.com/docs/environment-variables/system-environment-variables), only when the project opts in. Check this before your first deployment:
|
|
38
|
+
|
|
39
|
+
1. Open your project in the [Vercel dashboard](https://vercel.com/dashboard).
|
|
40
|
+
2. Go to **Settings**, then **Environment Variables**.
|
|
41
|
+
3. Select the **Enable access to System Environment Variables** checkbox.
|
|
42
|
+
4. Redeploy. The setting applies to new deployments; it does not change deployments that already exist.
|
|
43
|
+
|
|
44
|
+
`VERCEL_DEPLOYMENT_ID` is available at both build time and runtime, and Workflow reads it in both. The build uses it to decide whether to emit Vercel Function output, including the queue-triggered flow handler, or local development output. The runtime uses it to select the World.
|
|
45
|
+
|
|
46
|
+
<Callout type="warn">
|
|
47
|
+
With the checkbox cleared, a Vercel deployment is indistinguishable from a
|
|
48
|
+
non-Vercel environment as far as Workflow is concerned: the build emits local
|
|
49
|
+
output and, unless `WORKFLOW_TARGET_WORLD` is set, the runtime selects the
|
|
50
|
+
[Local World](/worlds/local), which stores workflow state on the filesystem.
|
|
51
|
+
A deployment's filesystem is read-only, so with this default selection,
|
|
52
|
+
every run fails before its first step, and no runs appear in the Vercel
|
|
53
|
+
dashboard because none were ever created in the Vercel World.
|
|
54
|
+
</Callout>
|
|
55
|
+
|
|
56
|
+
To confirm this is what you are hitting, log `process.env.VERCEL_DEPLOYMENT_ID` from a deployed function. If it is undefined (as is `VERCEL`), the setting is off.
|
|
57
|
+
|
|
58
|
+
Setting `WORKFLOW_TARGET_WORLD=vercel` is not a workaround. The Vercel World needs the deployment ID itself, to address queue messages to the deployment that created each run and to derive that deployment's encryption keys. Enable the checkbox and redeploy.
|
|
59
|
+
|
|
35
60
|
## Vercel platform documentation
|
|
36
61
|
|
|
37
62
|
For complete details on pricing, usage limits, and included allotments on Vercel, see the official Vercel documentation:
|
|
@@ -91,7 +116,7 @@ Learn more in the [Observability](/docs/observability) documentation.
|
|
|
91
116
|
|
|
92
117
|
## Configuration
|
|
93
118
|
|
|
94
|
-
The Vercel World requires no configuration when deployed to Vercel. For advanced use cases, you can override settings programmatically via `createVercelWorld()`.
|
|
119
|
+
The Vercel World requires no configuration when deployed to Vercel, beyond leaving [system environment variables](#system-environment-variables) enabled for the project so that `VERCEL_DEPLOYMENT_ID` reaches your build and your functions. For advanced use cases, you can override settings programmatically via `createVercelWorld()`.
|
|
95
120
|
|
|
96
121
|
### `WORKFLOW_VERCEL_ENV`
|
|
97
122
|
|
|
@@ -164,6 +164,16 @@ export async function myWorkflow(input: unknown) {
|
|
|
164
164
|
|
|
165
165
|
Uncaught, the run fails immediately with the `USER_ERROR` code — without retrying. See [serialization-failed](/docs/errors/serialization-failed) for common causes and fixes.
|
|
166
166
|
|
|
167
|
+
## Backend Connection Failures
|
|
168
|
+
|
|
169
|
+
On Vercel, backend connection failures and interrupted event streams use the existing retry policies, even when their error codes are unrecognized. This lets workflows recover from network failures instead of immediately failing with `USER_ERROR`. Persistent failures can still exhaust the retry budget.
|
|
170
|
+
|
|
171
|
+
The SDK also replaces its shared events connection pool after repeated HTTP/2 session failures. Invalid backend URLs, including unsupported protocols and embedded credentials, fail immediately. Fetch requests to blocked ports or with unsupported headers (such as `Expect`) also fail without retrying.
|
|
172
|
+
|
|
173
|
+
A connection failure does not prove that the backend rejected a write: it may have accepted it before the response was lost. Continue to make step side effects [idempotent](/docs/foundations/idempotency).
|
|
174
|
+
|
|
175
|
+
Failed-run logs include the underlying error causes and their codes, exposing socket, DNS, or TLS errors behind messages such as `TypeError: fetch failed`. If a cause cannot be read, the log includes `[unavailable cause]` and the run can still be recorded as failed.
|
|
176
|
+
|
|
167
177
|
## Error Codes
|
|
168
178
|
|
|
169
179
|
When a workflow run fails, the error may include a `code` that classifies the failure. You can access it programmatically via the `Run` class:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "workflow",
|
|
3
|
-
"version": "4.8.
|
|
3
|
+
"version": "4.8.10",
|
|
4
4
|
"description": "Workflow SDK - Build durable, resilient, and observable workflows",
|
|
5
5
|
"main": "dist/typescript-plugin.cjs",
|
|
6
6
|
"type": "module",
|
|
@@ -57,18 +57,18 @@
|
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"ms": "2.1.3",
|
|
60
|
-
"@workflow/astro": "4.0.
|
|
61
|
-
"@workflow/cli": "4.3.
|
|
62
|
-
"@workflow/core": "4.8.
|
|
63
|
-
"@workflow/errors": "4.2.
|
|
60
|
+
"@workflow/astro": "4.0.25",
|
|
61
|
+
"@workflow/cli": "4.3.14",
|
|
62
|
+
"@workflow/core": "4.8.10",
|
|
63
|
+
"@workflow/errors": "4.2.2",
|
|
64
64
|
"@workflow/typescript-plugin": "4.0.3",
|
|
65
65
|
"@workflow/utils": "4.1.4",
|
|
66
|
-
"@workflow/next": "4.1.
|
|
67
|
-
"@workflow/nest": "4.0.
|
|
68
|
-
"@workflow/nitro": "4.1.
|
|
69
|
-
"@workflow/nuxt": "4.0.
|
|
70
|
-
"@workflow/sveltekit": "4.0.
|
|
71
|
-
"@workflow/rollup": "4.0.
|
|
66
|
+
"@workflow/next": "4.1.14",
|
|
67
|
+
"@workflow/nest": "4.0.26",
|
|
68
|
+
"@workflow/nitro": "4.1.16",
|
|
69
|
+
"@workflow/nuxt": "4.0.26",
|
|
70
|
+
"@workflow/sveltekit": "4.0.25",
|
|
71
|
+
"@workflow/rollup": "4.0.25"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@types/ms": "2.1.0",
|