Diffinery

homeflare/celldpublic

celld/docs/cloudflare-compat.md
242 lines · 10.4 KBRaw History

Cloudflare compatibility

celld implements the Cloudflare Workers APIs that this page links to. Read the Cloudflare documentation for the standard behavior of each API.

This page lists only an unavailable feature, a celld-specific limit, or an observable difference. If an entry has no note, celld intends to match the linked Cloudflare API.

  • Yes means that celld implements the API, except for the listed differences.
  • Partial means that a substantial part of the API is unavailable.
  • Experimental means that celld can change the API without notice.
  • No means that celld does not implement the API.

celld must reject an unsupported configuration or API at deployment or first use. An unsupported feature that does not cause an error is a defect.

Services

Each supported service has a page with an example and the known differences from Cloudflare.

servicestatus
WorkersYes
Durable ObjectsYes
Durable Object FacetsYes
ContainersExperimental
Static assetsYes
Cron TriggersYes
Dynamic WorkersYes
KVYes
QueuesYes
D1Yes
WorkflowsYes
R2Yes
Workers AINo
VectorizeNo
HyperdriveNo
Browser RenderingNo
Email WorkersNo
Python WorkersNo

Runtime APIs

APIstatus
Fetch, Request, Response, and HeadersYes
BindingsYes
ContextYes
HandlersYes
RPCYes
StreamsYes
EncodingYes
WebSocketsYes
Web CryptoYes
Web standardsYes
WebAssemblyYes
Performance and timersYes
ConsoleYes
Node.js compatibilityPartial
CachePartial
HTMLRewriterYes
TCP socketsYes
EventSourceYes
MessageChannelYes
BroadcastChannelNo

Fetch, Request, Response, and Headers

  • The cache request option is unavailable.
  • An inbound Request has a cf object without Cloudflare edge fields. celld cannot prove the geolocation, colo, or TLS metadata.
  • celld removes Content-Length from a Worker response, except for a HEAD response.
  • A remote Durable Object call cannot retry after request-body transmission starts because celld keeps no replay copy.
  • A remote Durable Object call waits for a rejected owner generation to change for at most CELLD_OPERATION_DEADLINE_MS.

Bindings

The services table lists the available binding types. Each binding type that the table does not list is unavailable.

Context

  • passThroughOnException() has no effect because celld has no CDN fallback.
  • ctx.facets is available only inside a Durable Object.

Handlers

The tail and email handlers are unavailable.

RPC

  • An RPC stub cannot cross an isolate boundary.
  • An AbortSignal in a Durable Object RPC call does not cross a node boundary.
  • A remote RPC retries only when the failed peer attempt did not start the method. Use a stable operation ID for an application retry.

Streams

  • celld expires an unclaimed and inactive HTTP stream after 60 seconds. A successful stream operation starts a new 60-second period.
  • An expired or unknown stream reports an error instead of EOF.

WebSockets

  • An outbound Worker socket closes when its event and waitUntil work end. A socket returned in the response stays open.
  • Each isolate-polled input queue has a 1 MiB budget for non-terminal frames. A message larger than 1 MiB uses the complete budget.
  • If the isolate stops polling, celld discards unread frames during cleanup. A later pull reports an abnormal close.
  • A WebSocket transport cannot move to a new cell owner. A client must reconnect with the same application operation ID.
  • A tunneled connection forwards the owner's Close without an additional Close. If the owner connection fails between frames before a Close, the ingress sends code 1012. If a frame is incomplete, the ingress closes the transport instead.
  • acceptWebSocket() throws above 90 percent of the V8 heap limit.

Web Crypto

  • HMAC accepts MD5, SHA-1, SHA-224, SHA-256, SHA-384, and SHA-512.
  • ECDSA supports only the P-256 curve with SHA-256.
  • AES-GCM accepts authentication tags from 96 through 128 bits in 8-bit steps.
  • RSA-OAEP accepts SHA-1, SHA-256, SHA-384, and SHA-512. A nonempty label must contain valid UTF-8.
  • A secret key cannot use jwk with exportKey() or wrapKey().

Web standards

Performance and timers

performance.timeOrigin is 0, and performance.now() matches Date.now(). Both clocks advance at an I/O boundary and stay fixed during JavaScript execution.

Node.js compatibility

  • celld implements node:assert, node:async_hooks, node:buffer, node:diagnostics_channel, node:events, node:fs, node:os, node:path, node:stream, node:timers/promises, and node:util.
  • node:diagnostics_channel does not export messages to a tail Worker.
  • node:crypto does not implement Diffie-Hellman, streaming signatures, ciphers, RSA-PSS, or DSA signatures and key generation.
  • KeyObject.toCryptoKey() applies the requested algorithm, extractability, and usages to an asymmetric key.
  • node:zlib implements only the synchronous gzip and deflate functions.
  • node:fs provides access, mkdir, realpath, stat, lstat, and readFile. It exposes an empty, request-local /tmp and a read-only /bundle that contains the Worker modules.
  • The global process gives each field that it defines the same value that workerd gives it, so a dependency that reads process.execPath, process.argv, or process.title at module scope can load. celld does not define the full workerd surface, so a field such as process.kill or process.features is undefined.
  • The celld bundler supports a synchronous CommonJS require() of a Node.js built-in module. A raw ESM Worker has no global require().
  • A Node.js built-in module object is writable, so a CommonJS dependency that replaces a function on the module at load can start. The graceful-fs package replaces fs.close this way. A patch stays in the isolate that applies it, therefore another Worker never observes the patch.
  • An import of another Node.js module succeeds, but its first call throws an error.

Cache

celld provides an always-miss cache because it has no shared edge cache. put() validates and consumes a response but stores nothing, match() returns undefined, and delete() returns false.

TCP sockets

  • A socket cannot outlive its event. A Durable Object must reconnect during a later event.
  • celld verifies a TLS server against its bundled Mozilla root store.
  • celld does not block the destination ports that Cloudflare blocks. The fleet network controls the egress policy.

BroadcastChannel

celld defines the class so that a bundle can load, but its constructor throws an error.

Compatibility flags

celld honors these compatibility switches:

  • delete_all_deletes_alarm
  • js_rpc
  • fetcher_no_get_put_delete
  • sqlite_vec
  • websocket_standard_binary_type
  • The static-assets navigation flags

celld accepts each other compatibility flag without effect. Cloudflare.compatibilityFlags reports only the flags that celld honors.

Wrangler configuration

celld deploy accepts wrangler.jsonc or wrangler.json. It does not accept wrangler.toml.

The name value must contain 1 to 63 lowercase ASCII letters, digits, or internal hyphens. It cannot start or end with a hyphen.

The deployment accepts these top-level keys:

  • $schema, name, main, and no_bundle
  • compatibility_date and compatibility_flags
  • durable_objects and migrations
  • assets, services, triggers, and vars
  • d1_databases, kv_namespaces, queues, workflows, and r2_buckets
  • worker_loaders and containers
  • define and rules

Each other top-level key, including routes, stops the deployment.

celld deploy bundles with esbuild, and it gives define and rules to that run. Each define value is a JavaScript expression, as it is for Wrangler. A rule must have a type of Text, Data, or CompiledWasm, and each of its globs must have the form **/*.ext or *.ext: esbuild selects a loader by file extension, so celld refuses a glob that selects a different set of files.

Two rules can name one extension only if they give it the same type. Two rules that give one extension different types stop the deployment, because no single loader satisfies both. celld applies a CompiledWasm rule to **/*.wasm already, so a CompiledWasm rule for that extension agrees with the built-in rule and the deployment continues. Another type for **/*.wasm stops the deployment.

no_bundle does not run esbuild. A config that sets no_bundle with define or rules therefore stops the deployment.

An asset-only project can omit main. The native deploy command refuses an unsafe asset path, and .assetsignore requires Wrangler.

See Limitations for the operating-system, networking, security, pressure, and update boundaries.