Migrate from Cloudflare Workers
OpenFlare runs the real workerd runtime and reads wrangler-style configuration, so most Workers projects deploy with little or no code change. What does change is everything around the code: where resources live, how ids work, how data gets in, and how traffic reaches the worker. This guide is the full path from “it runs on Cloudflare” to “it runs on my OpenFlare”.
What to expect
Section titled “What to expect”| Moves unchanged | Needs a decision or a change | Does not move |
|---|---|---|
Worker code (ES modules), compatibility_date and flags within the pinned runtime, [vars], KV, Cron Triggers, version metadata |
D1 and R2 data, secrets values, hostnames and DNS, Durable Object state, Queues, Workflows, service bindings, anything marked Partial | Workers AI, AI Search, Pipelines, mTLS certificates, dispatch namespaces, Containers, legacy wasm_modules/text_blobs/data_blobs |
Read Compatibility first; this page builds on it.
Migration plan
Section titled “Migration plan”- Audit the project for unsupported features.
- Install OpenFlare and the
ofCLI and log in. - Create the resources your bindings need.
- Run
of checkand deploy to a hostname that carries no production traffic. - Migrate the data and secrets.
- Verify against the checklist.
- Cut over traffic, keeping the Cloudflare deployment as the rollback.
Run the old and new deployments side by side until step 8. Nothing in this procedure modifies your Cloudflare account.
1. Audit the project
Section titled “1. Audit the project”Configuration keys
Section titled “Configuration keys”OpenFlare reads wrangler.json, wrangler.jsonc or wrangler.toml (and Cloudflare’s programmatic cloudflare.config.ts/.js, which needs Node.js 22.18 or newer and @cloudflare/config installed in the project). Check your config against these three lists.
Rejected. The deploy fails with VRT_CONFIG_UNSUPPORTED_FIELD. Remove the key, or accept that the feature has no OpenFlare equivalent:
ai, ai_search, ai_search_namespaces, mtls_certificates, pipelines, dispatch_namespaces, containers, wasm_modules, text_blobs, data_blobs, logpush, site, node_compat, and wildcard custom_domain routes.
Accepted and ignored. Harmless, so you can leave them in place:
account_id, workers_dev, send_metrics, keep_vars, build, alias, tsconfig, preserve_file_names, upload_source_maps, cwd, config, placement.
Partially supported or restricted. limits accepts cpu_ms and subrequests only. unsafe accepts unsafe_eval only. R2 jurisdiction and storage_class are rejected. D1 migrations_table is not supported. transferred_classes in Durable Object migrations is rejected.
Search the source for the things that behave differently:
| Look for | Why |
|---|---|
request.cf fields outside country, colo, httpProtocol, asn, asOrganization, city, continent, region, regionCode, metroCode, postalCode, timezone, latitude, longitude, isEUCountry |
Other fields are absent, including botManagement and tls*. |
caches.default, cache.match, cacheTtl |
Cache API is per host, in memory and not persistent; there is no edge cache tier. |
| WebSocket hibernation APIs | Hibernation is not emulated; connections idle out after 300 s and live at most 4 h. |
| Rate limiting binding | A fixed window per process, not global. |
env.AI, env.BROWSER, env.IMAGES, env.VECTORIZE |
AI is unsupported. Browser is not Chromium. Images and Vectorize are partial. |
Smart Placement, placement |
No edge network and no placement. |
| Long idle gaps between requests | Idle workers are frozen; the first request pays a wake-up cost. |
Bindings
Section titled “Bindings”For each binding, find its row in the mapping table below. Anything in the Unsupported column blocks the migration of that worker.
2. Prepare the target
Section titled “2. Prepare the target”- Bring up OpenFlare with the Quickstart or Docker deployment.
- Install the
ofCLI and log in. See the CLI reference.
printf '%s' "$PLANE_ADMIN_TOKEN" | of login --url https://plane.example.com --team acmeof whoami- Check the runtime your installation pins, so your
compatibility_dateand flags are accepted:
curl -sS -H "Authorization: Bearer $PLANE_ADMIN_TOKEN" \ https://plane.example.com/api/v1/worker-compatibilityThe response contains the pinned workerd version, the newest accepted compatibility_date (maxDate) and the supported flags. A date newer than maxDate, an unsupported flag, or too many flags is rejected at deploy time.
3. Create resources
Section titled “3. Create resources”OpenFlare mints resource ids itself. The id, database_id or bucket_name in your config is used to look up a resource you already created on OpenFlare, so Cloudflare’s ids will not match. Create the resources first, then make the config refer to them.
Binding mapping
Section titled “Binding mapping”| Cloudflare binding | Config key | Create on OpenFlare | Status |
|---|---|---|---|
| KV | kv_namespaces |
of kv namespace create <title> |
Drop-in |
| D1 | d1_databases |
of d1 create <name> |
Partial |
| R2 | r2_buckets |
of r2 bucket create <name> or a proxy bucket |
Partial |
| Durable Objects | durable_objects, migrations |
Declared by deploy; lifecycle via of durable-objects |
Partial |
| Queues | queues |
of queues create <name> |
Partial |
| Workflows | workflows |
Declarations upserted by deploy; needs the workflows cell capability |
Partial |
| Hyperdrive | hyperdrive |
of hyperdrive create (credential-less origin, password on stdin) |
Partial |
| Service bindings | services |
Deploy the target worker first | Partial, single-tenant |
| Analytics Engine | analytics_engine_datasets |
Declared by deploy | Partial, no hosted SQL API |
| Static assets | assets |
Uploaded by deploy | Partial, limits differ |
| Secrets Store | secrets_store_secrets |
of secrets-store put |
Partial, needs secretsStore capability |
| Cron Triggers | triggers.crons |
Declared by deploy | Drop-in |
| Version metadata | version_metadata |
None | Drop-in |
| Vars and secrets | vars, secrets |
See step 6 | Partial |
| Workers AI, AI Search, Pipelines, mTLS, dispatch namespaces, Containers | various | None | Unsupported |
Per-binding behavior, limits and caveats are in Bindings.
Example: a KV and D1 worker
Section titled “Example: a KV and D1 worker”Before, on Cloudflare:
name = "api"main = "src/index.ts"compatibility_date = "2025-01-01"account_id = "0123456789abcdef"
[[kv_namespaces]]binding = "CACHE"id = "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4"
[[d1_databases]]binding = "DB"database_name = "api-db"database_id = "11111111-2222-3333-4444-555555555555"Create the resources on OpenFlare, then reference them by the names you gave them:
of kv namespace create api-cacheof d1 create api-dbname = "api"main = "src/index.ts"compatibility_date = "2025-01-01"
[[kv_namespaces]]binding = "CACHE"id = "api-cache"
[[d1_databases]]binding = "DB"database_name = "api-db"database_id = "api-db"4. Check and deploy without traffic
Section titled “4. Check and deploy without traffic”of check . # offline: normalization, bundling, validationof deploy . --dry-runof deploy .of check needs no connection and is a good CI gate. --dry-run validates and prints a summary without sending anything. A real deploy creates an immutable version, activates it and publishes a signed snapshot; confirm with the Deployments tab in the console that the publication reaches APPLIED.
Attach a hostname that carries no production traffic (a staging name, or a temporary subdomain) so you can test the worker before cutover. See Deploy a worker: Domains, and DNS with Cloudflare or Local hostnames for the Docker setup.
If of deploy refuses with a message about control-plane features the CLI cannot reproduce, manage that worker through the console or API. See Deploy a worker.
5. Migrate data
Section titled “5. Migrate data”OpenFlare does not read your Cloudflare account. You export from Cloudflare with Cloudflare’s own tooling, then import with of. Confirm Cloudflare’s export commands against the current wrangler documentation; they live on Cloudflare’s side and may change.
- Export keys and values from Cloudflare (for example with
wrangler kv key listandwrangler kv key get, or Cloudflare’s bulk export). - Import with a bulk write:
of kv bulk put keys.json --namespace api-cachekeys.json is the JSON array that bulk put accepts. Constraints through the control plane: values must be UTF-8 and at most 1 MiB; expiration_ttl must be at least 60 seconds and cannot be combined with expiration; a bulk call carries 1 to 1000 items and at most 8 MiB, and is not atomic, so a failed call can leave a partial write. Split large exports into batches and re-run failed batches.
- Export the database from Cloudflare as SQL (
wrangler d1 exportwith--remote). - Apply your schema through migrations, so OpenFlare’s ledger knows what has run:
of d1 migrations apply api-db --config wrangler.tomlDeploys never apply migrations; run this explicitly. The CLI reads migrations_dir (default migrations), orders files by numeric prefix and sends only unapplied ones, so re-running is safe. Limits: 512 migrations per call, 256 KiB per migration.
- Load the data.
of d1 queryaccepts SQL from--sql,--fileor standard input, up to 100 KiB per call, so split a large dump into statements batches under that size:
of d1 query api-db --file data-part-001.sqlVerify row counts against Cloudflare before cutover:
of d1 query api-db --sql 'SELECT COUNT(*) AS n FROM users'There are two approaches.
Keep the data where it is. An OpenFlare R2 bucket can be a prefix inside a bucket on Cloudflare R2 or Amazon S3. Create a proxy bucket pointing at your existing storage, and no object copy is needed. See R2 storage backends. This requires a runtime build that includes proxy backends; confirm yours does.
Copy the data in. For the local backend there is no bulk import command. of r2 object put writes one object at a time and, because bodies are base64-encoded within a 1 MiB request, only suits small objects:
of r2 object put images/logo.png --bucket assets --file ./logo.png --content-type image/pngFor larger objects, copy from inside a worker bound to both the source and the destination (for example, a one-off migration worker that reads from an S3-compatible source and writes with its R2 binding). The binding path has no 1 MiB limit.
Durable Objects, Queues, Workflows
Section titled “Durable Objects, Queues, Workflows”- Durable Objects: declare classes in
[[migrations]]as you do on Cloudflare. Deploys do not replay lifecycle operations; useof durable-objectsfor transfer, rename and delete. This documentation describes no way to import existing Durable Object storage from Cloudflare, so plan to rebuild state from your system of record or let it repopulate. - Queues: create the queues, then redeploy producers and consumers. In-flight messages on Cloudflare do not move; drain them before cutover. Messages are at most 128 KiB.
- Workflows: declarations are upserted by
of deploy. Running instances on Cloudflare do not move; let them finish first.
6. Migrate secrets
Section titled “6. Migrate secrets”Cloudflare never returns secret values, so they must come from your own secret store. Declared secrets with no value fail the deploy.
# at deploy time, from CI or your password manager, without putting values in argvprintf 'API_KEY=%s\nDB_URL=%s\n' "$API_KEY" "$DB_URL" | of deploy . --secrets-file -
# or one at a timeprintf '%s' "$API_KEY" | of secret put --worker api API_KEYof secret ls --worker api # names onlyA name cannot be both a var and a secret. Plain vars come across through [vars]; typed JSON vars are preserved up to 16 KiB each when the cell advertises jsonBindings.
7. Verify
Section titled “7. Verify”Work through this before touching DNS.
| Check | How |
|---|---|
| Config accepted | of check . exits 0 |
| Runs locally | of dev . starts and the worker answers on http://127.0.0.1:8787; see Local development |
| Rollout applied | Console Deployments tab shows APPLIED |
| Worker responds | Request the staging hostname; compare status, headers and body to Cloudflare for your key routes |
| KV | Read a handful of keys through the worker and via of kv key get |
| D1 | Row counts match; run your most important queries |
| R2 | List the bucket (of r2 object list --bucket <name>) and fetch sample objects |
| Secrets | of secret ls --worker <name> shows every declared name; exercise code paths that use them |
| Scheduled handlers | Confirm cron triggers fire; check logs with of logs --worker <name> |
| Cold start | Time the first request after idle; compare with your latency budget |
| WebSockets | Test through the final hostname and TLS path, including idle behavior |
| Logs | of logs --worker <name> --limit 200, then watch for errors under load |
Behavior that differs by design (no edge network, per-process rate limits, in-memory Cache API, trimmed request.cf) will not show up as failures in a smoke test, so exercise those code paths on purpose.
8. Cut over traffic
Section titled “8. Cut over traffic”- Lower the DNS TTL on the production hostname well ahead of time (at least the old TTL before you plan to switch).
- Attach the production hostname to the OpenFlare worker. A custom hostname starts as a pending claim: publish the
_openflare.<hostname>TXT verification record, then verify from the console orPOST .../hostnames/{hostname}/verify. The token expires after 24 hours. - Make sure TLS is ready for that name. See TLS certificates. Check how certificates are issued for your installation before you move a production name.
- Point the DNS record at your OpenFlare edge.
- Watch logs and error rates.
If the hostname is currently served by a Cloudflare Worker route or custom domain, remove or disable that route on Cloudflare at the moment of the switch so the two do not compete.
Rollback
Section titled “Rollback”Keep the Cloudflare deployment intact and warm until you are satisfied. To roll back, point DNS back at Cloudflare and re-enable the route there. Because writes during the OpenFlare window land in OpenFlare’s KV, D1 and R2, decide beforehand how you will reconcile them; there is no automatic reverse sync.
Within OpenFlare, you can also roll a worker back to an earlier version without touching DNS:
of versions list --worker apiof rollback --worker api <version_id>Common problems
Section titled “Common problems”| Symptom | Cause and fix |
|---|---|
VRT_CONFIG_UNSUPPORTED_FIELD |
A rejected key in config. See the audit list. |
VRT_COMPATIBILITY_DATE_INVALID |
compatibility_date is newer than the runtime’s maxDate. Query /api/v1/worker-compatibility and lower it. |
VRT_COMPATIBILITY_FLAG_UNSUPPORTED or VRT_COMPATIBILITY_FLAGS_LIMIT |
A flag the pinned runtime does not support, or too many flags. |
| Deploy fails because a resource is missing | The id, database_id or bucket_name does not match something you created on OpenFlare. Cloudflare ids do not carry over. |
| Deploy fails on a secret | A declared secret has no value. Supply it with --secrets-file or of secret put. |
409 with VRT_CELL_CAPABILITY_MISSING |
The feature needs a cell capability your cell does not advertise. See Compatibility. |
| Custom hostname stays pending | The TXT record is missing or expired. Republish the record and verify again. |
| Deploy blocked by an unlisted hostname | of deploy never deletes hostnames. Declare it in config or of hostnames rm. |
| First request after idle is slow | Scale to zero. Idle workers freeze by design. |
| Bulk KV import partly applied | Bulk writes are not atomic. Re-run the failed batches. |
More deploy-time problems are in Deploy a worker: Troubleshooting and Troubleshooting.