# Workflows hosts

## Providers

| Provider | Configure with | Provider output | Nuance |
| --- | --- | --- | --- |
| Cloudflare | `workflow: { provider: 'cloudflare' }` | Workflow class, binding, and runtime entry. | Runs through Cloudflare Workflow bindings. Set `binding` and `name` to match existing resources. |
| Vercel | `workflow: { provider: 'vercel' }` | Workflow runtime in the build output, on Vercel only. Other hosts get none. | A `native` entry uses Workflow DevKit for durable execution. The normal handler runs inline and stops if the function restarts. |
| OpenWorkflow | `workflow: { provider: 'openworkflow', postgres: { url } }` or `workflow: { provider: 'openworkflow', sqlite: { path } }` | OpenWorkflow worker and runtime. | Choose Postgres or SQLite for deployment. Set `postgres.url` or `sqlite.path`, not both. |

### Upgrade the Vercel Workflow SDK

ViteHub uses `workflow` 5.2.3 and `@workflow/builders` 5.0.6. This has the `nanoid` security fix without the inline early-advance scheduling of Workflow 5.3.0. That scheduling can complete a run while a losing `Promise.race` step still runs, cut its retries short, and write its step events after `run_completed`. So ViteHub stays on 5.2.3.

Workflow 5.2.0 also fixes reuse of a hook after it loses a `Promise.race`. Runs that already took the timeout branch in that case may not replay after an in-place upgrade. Finish them with the old SDK before you upgrade the process that runs them.

> [!WARNING]
> For native workflows on the SDK's Local World in development, upgrading from the previous version (`workflow` 5.0.1) is a **destructive local reset**. The bundled `@workflow/world-local` 5.1.2 deletes run data in the older flat event/step layout on first start. It does not migrate it. The new SDK cannot inspect or resume those runs.

Before you start the new SDK:

1. Stop every process that uses that Local World.
2. Back up its whole data directory to a place outside it. The default is `.workflow-data`. `WORKFLOW_LOCAL_DATA_DIR` sets another location.
3. Finish the runs you need with the old SDK, or keep the backup and the old SDK to inspect and resume them.
4. To keep the old files, start the new SDK with `WORKFLOW_LOCAL_DATA_DIR` set to a separate, empty directory.

This reset affects Local World storage only, not runs in Vercel's hosted World.

### Select OpenWorkflow storage

OpenWorkflow resolves storage at runtime in this order:

1. `sqlite.path` selects SQLite, and `postgres.url` selects Postgres. Set only one. If its environment value is missing or empty, startup fails. It does not fall back to another store.
2. With neither set, `OPENWORKFLOW_SQLITE_PATH` selects SQLite.
3. Else `OPENWORKFLOW_POSTGRES_URL`, then `DATABASE_URL`, selects Postgres.
4. Else it uses `.vitehub/data/openworkflow.sqlite.db` in the process working directory.

> [!WARNING]
> The SQLite default needs a writable filesystem. Its state lives only as long as that file. A new container or a temporary function filesystem can lose it. Set up persistent storage before production. Keep staging and production storage or namespaces apart.

`workflow.database` is not supported and fails the config. It used to accept a Named Database without connecting OpenWorkflow to it. Use `workflow.postgres.url` or `workflow.sqlite.path` instead. Check where the old runtime really stored runs before you move them.

<!-- vitehub-docs:section-links -->
## In this section

- [Overview](https://vitehub.dev/raw/docs/workflows.md)
- [Get started](https://vitehub.dev/raw/docs/workflows/get-started.md)
- [Configure](https://vitehub.dev/raw/docs/workflows/configure.md)
- [Server API](https://vitehub.dev/raw/docs/workflows/server-api.md)
- [Hosts](https://vitehub.dev/raw/docs/workflows/hosts.md) (this page)
- [Limits and errors](https://vitehub.dev/raw/docs/workflows/limits-and-errors.md)
- [Concepts](https://vitehub.dev/raw/docs/workflows/concepts.md)

Next: [WORKFLOW_R0007](https://vitehub.dev/raw/docs/workflows/diagnostics/workflow_r0007.md)

All pages: [llms.txt](https://vitehub.dev/llms.txt)
