Diffinery

homeflare/celldpublic

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