healthCheck

Performs an end-to-end health check of a deployment's workflow infrastructure by sending a message through the queue pipeline and verifying it is processed by the workflow endpoint. Because it goes through the queue rather than direct HTTP, it works even when the deployment is behind Deployment Protection on Vercel.

import { getWorld, healthCheck } from "workflow/runtime";

const world = await getWorld();
const result = await healthCheck(world);

if (!result.healthy) {
  console.error("Workflow infrastructure unhealthy:", result.error);
}

API signature

Parameters

ParameterTypeDescription
worldWorldThe World instance to send the health check through
optionsHealthCheckOptionsOptional configuration

Where HealthCheckOptions is:

OptionTypeDescription
timeoutnumberMilliseconds to wait for the health check response. Default: 30000.
deploymentIdstringDeployment to target. Falls back to process.env.VERCEL_DEPLOYMENT_ID.
namespacestringQueue namespace of the target deployment. Falls back to WORKFLOW_QUEUE_NAMESPACE.

Returns

Returns a Promise<HealthCheckResult>:

PropertyTypeDescription
healthybooleanWhether the combined workflow endpoint processed the health check message
errorstring | undefinedError message when the check failed
latencyMsnumber | undefinedRound-trip latency when the check succeeded
specVersionnumber | undefinedWorkflow spec version of the responding deployment
workflowCoreVersionstring | undefined@workflow/core version of the responding deployment
dynamicWorkflowVersionnumber | undefinedDynamic-workflow runtime version of the responding deployment. Present only when it has opted in with WORKFLOW_EXPERIMENTAL_DYNAMIC_WORKFLOWS; see Dynamic Workflows