Skip to content

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”.

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.

  1. Audit the project for unsupported features.
  2. Install OpenFlare and the of CLI and log in.
  3. Create the resources your bindings need.
  4. Run of check and deploy to a hostname that carries no production traffic.
  5. Migrate the data and secrets.
  6. Verify against the checklist.
  7. 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.

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.

For each binding, find its row in the mapping table below. Anything in the Unsupported column blocks the migration of that worker.

  1. Bring up OpenFlare with the Quickstart or Docker deployment.
  2. Install the of CLI and log in. See the CLI reference.
Terminal window
printf '%s' "$PLANE_ADMIN_TOKEN" | of login --url https://plane.example.com --team acme
of whoami
  1. Check the runtime your installation pins, so your compatibility_date and flags are accepted:
Terminal window
curl -sS -H "Authorization: Bearer $PLANE_ADMIN_TOKEN" \
https://plane.example.com/api/v1/worker-compatibility

The 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.

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.

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.

Before, on Cloudflare:

wrangler.toml
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:

Terminal window
of kv namespace create api-cache
of d1 create api-db
wrangler.toml (OpenFlare)
name = "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"
Terminal window
of check . # offline: normalization, bundling, validation
of deploy . --dry-run
of 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.

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.

  1. Export keys and values from Cloudflare (for example with wrangler kv key list and wrangler kv key get, or Cloudflare’s bulk export).
  2. Import with a bulk write:
Terminal window
of kv bulk put keys.json --namespace api-cache

keys.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.

  1. Export the database from Cloudflare as SQL (wrangler d1 export with --remote).
  2. Apply your schema through migrations, so OpenFlare’s ledger knows what has run:
Terminal window
of d1 migrations apply api-db --config wrangler.toml

Deploys 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.

  1. Load the data. of d1 query accepts SQL from --sql, --file or standard input, up to 100 KiB per call, so split a large dump into statements batches under that size:
Terminal window
of d1 query api-db --file data-part-001.sql

Verify row counts against Cloudflare before cutover:

Terminal window
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:

Terminal window
of r2 object put images/logo.png --bucket assets --file ./logo.png --content-type image/png

For 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: declare classes in [[migrations]] as you do on Cloudflare. Deploys do not replay lifecycle operations; use of durable-objects for 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.

Cloudflare never returns secret values, so they must come from your own secret store. Declared secrets with no value fail the deploy.

Terminal window
# at deploy time, from CI or your password manager, without putting values in argv
printf 'API_KEY=%s\nDB_URL=%s\n' "$API_KEY" "$DB_URL" | of deploy . --secrets-file -
# or one at a time
printf '%s' "$API_KEY" | of secret put --worker api API_KEY
of secret ls --worker api # names only

A 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.

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.

  1. Lower the DNS TTL on the production hostname well ahead of time (at least the old TTL before you plan to switch).
  2. 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 or POST .../hostnames/{hostname}/verify. The token expires after 24 hours.
  3. 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.
  4. Point the DNS record at your OpenFlare edge.
  5. 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.

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:

Terminal window
of versions list --worker api
of rollback --worker api <version_id>
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.