Diffinery

homeflare/celldpublic

celld/docs/cloudflare-compat.md
241 lines · 10.6 KBRaw History
1# Cloudflare compatibility
2
3This page lists only the differences from the linked Cloudflare APIs. An entry
4without a note matches Cloudflare.
5
6- **Yes**: implemented, except for the listed differences.
7- **Partial**: a substantial part is unavailable.
8- **Experimental**: can change without notice.
9- **No**: not implemented.
10
11celld rejects an unsupported configuration or API at deployment or first use.
12An unsupported feature that does not cause an error is a defect.
13
14## Services
15
16| service | status |
17| --- | --- |
18| [Workers](services/workers.md) | **Yes** |
19| [Durable Objects](services/durable-objects.md) | **Yes** |
20| [Durable Object Facets](services/durable-object-facets.md) | **Yes** |
21| [Containers](services/containers.md) | **Experimental** |
22| [Static assets](services/static-assets.md) | **Yes** |
23| [Cron Triggers](services/cron-triggers.md) | **Yes** |
24| [Dynamic Workers](services/dynamic-workers.md) | **Yes** |
25| [KV](services/kv.md) | **Yes** |
26| [Queues](services/queues.md) | **Yes** |
27| [D1](services/d1.md) | **Yes** |
28| [Workflows](services/workflows.md) | **Yes** |
29| [R2](services/r2.md) | **Yes** |
30| Workers AI | **No** |
31| Vectorize | **No** |
32| Hyperdrive | **No** |
33| Browser Rendering | **No** |
34| Email Workers | **No** |
35| [Python Workers](services/workers.md#python-workers) | **Partial** — `fetch` handlers on the Pyodide 0.28 runtime line |
36
37## Runtime APIs
38
39| API | status |
40| --- | --- |
41| [Fetch, Request, Response, and Headers](#fetch-request-response-and-headers) | **Yes** |
42| [Bindings](#bindings) | **Yes** |
43| [Context](#context) | **Yes** |
44| [Handlers](#handlers) | **Yes** |
45| [RPC](#rpc) | **Yes** |
46| [Streams](#streams) | **Yes** |
47| Encoding | **Yes** |
48| [WebSockets](#websockets) | **Yes** |
49| [Web Crypto](#web-crypto) | **Yes** |
50| [Web standards](#web-standards) | **Yes** |
51| WebAssembly | **Yes** |
52| [Performance and timers](#performance-and-timers) | **Yes** |
53| Console | **Yes** |
54| [Node.js compatibility](#nodejs-compatibility) | **Partial** |
55| [Cache](#cache) | **Partial** |
56| HTMLRewriter | **Yes** |
57| [TCP sockets](#tcp-sockets) | **Yes** |
58| EventSource | **Yes** |
59| MessageChannel | **Yes** |
60| BroadcastChannel | **No** |
61
62### [Fetch, Request, Response, and Headers](https://developers.cloudflare.com/workers/runtime-apis/fetch/)
63
64- The `cache` request option is unavailable.
65- An inbound `Request` has a `cf` object without Cloudflare edge fields. celld
66 cannot prove the geolocation, colo, or TLS metadata.
67- celld removes `Content-Length` from a Worker response, except for a `HEAD`
68 response.
69- A remote Durable Object call cannot retry after request-body transmission
70 starts because celld keeps no replay copy.
71- A remote Durable Object call waits for a rejected owner generation to change
72 for at most `CELLD_OPERATION_DEADLINE_MS`.
73
74### [Bindings](https://developers.cloudflare.com/workers/runtime-apis/bindings/)
75
76Only the binding types in the [services table](#services) are available.
77
78### [Context](https://developers.cloudflare.com/workers/runtime-apis/context/)
79
80- `passThroughOnException()` has no effect because celld has no CDN fallback.
81- `ctx.facets` is available only inside a Durable Object.
82
83### [Handlers](https://developers.cloudflare.com/workers/runtime-apis/handlers/)
84
85The `tail` and `email` handlers are unavailable.
86
87### [RPC](https://developers.cloudflare.com/workers/runtime-apis/rpc/)
88
89- An RPC stub cannot cross an isolate boundary.
90- An `AbortSignal` in a Durable Object RPC call does not cross a node boundary.
91- A remote RPC retries only when the failed peer attempt did not start the
92 method. Use a stable operation ID for an application retry.
93
94### [Streams](https://developers.cloudflare.com/workers/runtime-apis/streams/)
95
96- celld expires an unclaimed and inactive HTTP stream after 60 seconds. A
97 successful stream operation starts a new 60-second period.
98- An expired or unknown stream reports an error instead of EOF.
99
100### [WebSockets](https://developers.cloudflare.com/workers/runtime-apis/websockets/)
101
102- An outbound Worker socket closes when its event and `waitUntil` work end. A
103 socket returned in the response stays open.
104- Each isolate-polled input queue has a 1 MiB budget for non-terminal frames. A
105 message larger than 1 MiB uses the complete budget.
106- If the isolate stops polling, celld discards unread frames during cleanup. A
107 later pull reports an abnormal close.
108- A WebSocket transport cannot move to a new cell owner. A client must reconnect
109 with the same application operation ID.
110- A tunneled connection forwards the owner's Close without an additional Close.
111 If the owner connection fails between frames before a Close, the ingress sends
112 code 1012. If a frame is incomplete, the ingress closes the transport instead.
113- `acceptWebSocket()` throws above 90 percent of the V8 heap limit.
114- A response with a WebSocket to a request without `Upgrade: websocket` fails,
115 as in workerd. A Durable Object's `stub.fetch()` call then rejects, and an
116 HTTP client receives status 500. The server end of the socket receives a close
117 event with code 1006.
118- A Durable Object's `stub.fetch()` call rejects when the handler fails, on the
119 owner node and on any other node.
120
121### [Web Crypto](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)
122
123- HMAC accepts MD5, SHA-1, SHA-224, SHA-256, SHA-384, and SHA-512.
124- ECDSA supports only the P-256 curve with SHA-256.
125- AES-GCM accepts authentication tags from 96 through 128 bits in 8-bit steps.
126- RSA-OAEP accepts SHA-1, SHA-256, SHA-384, and SHA-512. A nonempty label must
127 contain valid UTF-8.
128- A secret key cannot use `jwk` with `exportKey()` or `wrapKey()`.
129- Ed25519 signs and verifies, and `NODE-ED25519` names the same algorithm. A
130 signature from one spelling verifies under the other.
131- X25519 derives bits and keys. A peer key of a low order gives a shared secret
132 of all zero bytes, so `deriveBits()` rejects that key instead.
133- An Ed25519 or X25519 public key uses its 32-byte point for the `raw` format,
134 so `importKey()` and `exportKey()` both carry the point alone.
135
136### [Web standards](https://developers.cloudflare.com/workers/runtime-apis/web-standards/)
137
138### [Performance and timers](https://developers.cloudflare.com/workers/runtime-apis/performance/)
139
140`performance.timeOrigin` is `0`, and `performance.now()` matches `Date.now()`.
141Both clocks advance at an I/O boundary and stay fixed during JavaScript
142execution.
143
144### [Node.js compatibility](https://developers.cloudflare.com/workers/runtime-apis/nodejs/)
145
146- celld implements `node:assert`, `node:async_hooks`, `node:buffer`,
147 `node:diagnostics_channel`, `node:events`, `node:fs`, `node:os`, `node:path`,
148 `node:stream`, `node:timers/promises`, and `node:util`.
149- `node:diagnostics_channel` does not export messages to a tail Worker.
150- `node:crypto` does not implement Diffie-Hellman, streaming signatures,
151 ciphers, RSA-PSS, or DSA signatures and key generation.
152- `KeyObject.toCryptoKey()` applies the requested algorithm, extractability,
153 and usages to an asymmetric key.
154- `node:zlib` implements only the synchronous gzip and deflate functions.
155- `node:net` provides `isIP`, `isIPv4` and `isIPv6` (Homeflare patch).
156- `node:dns` and `node:dns/promises` provide `lookup()`, which resolves
157 through the node's own resolver. The `resolve*()` functions are not
158 implemented (Homeflare patch).
159- `node:url` provides `URL`, `URLSearchParams`, `domainToASCII`,
160 `domainToUnicode`, `fileURLToPath`, `pathToFileURL`, `urlToHttpOptions` and
161 `format`. The legacy `parse`, `resolve` and `resolveObject` are not
162 implemented (Homeflare patch).
163- `node:fs` provides `access`, `mkdir`, `realpath`, `stat`, `lstat`, and
164 `readFile`. It exposes an empty, request-local `/tmp` and a read-only
165 `/bundle` that contains the Worker modules.
166- The global `process` matches workerd for each field that it defines, such
167 as `process.execPath`, `process.argv`, and `process.title`. Other fields,
168 such as `process.kill` and `process.features`, are undefined.
169- The celld bundler supports a synchronous CommonJS `require()` of a Node.js
170 built-in module. A raw ESM Worker has no global `require()`.
171- A Node.js built-in module object is writable, so a dependency such as
172 `graceful-fs` can patch it at load. The patch stays in its isolate.
173- An import of another Node.js module succeeds, but its first call throws an
174 error.
175
176### [Cache](https://developers.cloudflare.com/workers/runtime-apis/cache/)
177
178celld provides an always-miss cache because it has no shared edge cache.
179`put()` validates and consumes a response but stores nothing, `match()` returns
180`undefined`, and `delete()` returns `false`.
181
182### [TCP sockets](https://developers.cloudflare.com/workers/runtime-apis/tcp-sockets/)
183
184- A socket cannot outlive its event. A Durable Object must reconnect during a
185 later event.
186- celld verifies a TLS server against its bundled Mozilla root store.
187- celld does not block the destination ports that Cloudflare blocks. The fleet
188 network controls the egress policy.
189
190### BroadcastChannel
191
192The class exists so that a bundle can load, but its constructor throws.
193
194## Compatibility flags
195
196celld honors these compatibility flags:
197
198- `delete_all_deletes_alarm`
199- `js_rpc`
200- `fetcher_no_get_put_delete`
201- `sqlite_vec`
202- `websocket_standard_binary_type`
203- The static-assets navigation flags
204
205celld accepts every other flag without effect.
206`Cloudflare.compatibilityFlags` reports only the honored flags.
207
208## Wrangler configuration
209
210`celld deploy` accepts `wrangler.jsonc` or `wrangler.json`, not
211`wrangler.toml`.
212
213The `name` value must contain 1 to 63 lowercase ASCII letters, digits, or
214internal hyphens. It cannot start or end with a hyphen.
215
216The accepted top-level keys:
217
218- `$schema`, `name`, `main`, and `no_bundle`
219- `compatibility_date` and `compatibility_flags`
220- `durable_objects` and `migrations`
221- `assets`, `services`, `triggers`, and `vars`
222- `d1_databases`, `kv_namespaces`, `queues`, `workflows`, and
223 `r2_buckets`
224- `worker_loaders` and `containers`
225- `define` and `rules`
226
227Any other top-level key, including `routes`, stops the deployment.
228
229`define` and `rules` go to the esbuild run. Each `define` value is a
230JavaScript expression, as in Wrangler. A rule `type` must be `Text`, `Data`,
231or `CompiledWasm`, and each glob must have the form `**/*.ext` or `*.ext`,
232because esbuild selects a loader by extension. Two rules that give one
233extension different types stop the deployment. celld already applies
234`CompiledWasm` to `**/*.wasm`, so only that type is valid for `.wasm`.
235`no_bundle` skips esbuild, so `no_bundle` with `define` or `rules` stops the
236deployment.
237
238An asset-only project can omit `main`. `celld deploy` refuses an unsafe asset
239path, and `.assetsignore` requires Wrangler.
240
241See [Limitations](limitations.md) for the operational limits.