Diffinery

homeflare/celldpublic

celld/docs/cloudflare-compat.md
242 lines · 10.4 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 | **No** |
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
132### [Web standards](https://developers.cloudflare.com/workers/runtime-apis/web-standards/)
133
134### [Performance and timers](https://developers.cloudflare.com/workers/runtime-apis/performance/)
135
136`performance.timeOrigin` is `0`, and `performance.now()` matches `Date.now()`.
137Both clocks advance at an I/O boundary and stay fixed during JavaScript
138execution.
139
140### [Node.js compatibility](https://developers.cloudflare.com/workers/runtime-apis/nodejs/)
141
142- celld implements `node:assert`, `node:async_hooks`, `node:buffer`,
143 `node:diagnostics_channel`, `node:events`, `node:fs`, `node:os`, `node:path`,
144 `node:stream`, `node:timers/promises`, and `node:util`.
145- `node:diagnostics_channel` does not export messages to a tail Worker.
146- `node:crypto` does not implement Diffie-Hellman, streaming signatures,
147 ciphers, RSA-PSS, or DSA signatures and key generation.
148- `KeyObject.toCryptoKey()` applies the requested algorithm, extractability,
149 and usages to an asymmetric key.
150- `node:zlib` implements only the synchronous gzip and deflate functions.
151- `node:fs` provides `access`, `mkdir`, `realpath`, `stat`, `lstat`, and
152 `readFile`. It exposes an empty, request-local `/tmp` and a read-only
153 `/bundle` that contains the Worker modules.
154- The global `process` gives each field that it defines the same value that
155 workerd gives it, so a dependency that reads `process.execPath`,
156 `process.argv`, or `process.title` at module scope can load. celld does not
157 define the full workerd surface, so a field such as `process.kill` or
158 `process.features` is undefined.
159- The celld bundler supports a synchronous CommonJS `require()` of a Node.js
160 built-in module. A raw ESM Worker has no global `require()`.
161- A Node.js built-in module object is writable, so a CommonJS dependency that
162 replaces a function on the module at load can start. The `graceful-fs`
163 package replaces `fs.close` this way. A patch stays in the isolate that
164 applies it, therefore another Worker never observes the patch.
165- An import of another Node.js module succeeds, but its first call throws an
166 error.
167
168### [Cache](https://developers.cloudflare.com/workers/runtime-apis/cache/)
169
170celld provides an always-miss cache because it has no shared edge cache.
171`put()` validates and consumes a response but stores nothing, `match()` returns
172`undefined`, and `delete()` returns `false`.
173
174### [TCP sockets](https://developers.cloudflare.com/workers/runtime-apis/tcp-sockets/)
175
176- A socket cannot outlive its event. A Durable Object must reconnect during a
177 later event.
178- celld verifies a TLS server against its bundled Mozilla root store.
179- celld does not block the destination ports that Cloudflare blocks. The fleet
180 network controls the egress policy.
181
182### BroadcastChannel
183
184celld defines the class so that a bundle can load, but its constructor throws an
185error.
186
187## Compatibility flags
188
189celld honors these compatibility switches:
190
191- `delete_all_deletes_alarm`
192- `js_rpc`
193- `fetcher_no_get_put_delete`
194- `sqlite_vec`
195- `websocket_standard_binary_type`
196- The static-assets navigation flags
197
198celld accepts each other compatibility flag without effect.
199`Cloudflare.compatibilityFlags` reports only the flags that celld honors.
200
201## Wrangler configuration
202
203`celld deploy` accepts `wrangler.jsonc` or `wrangler.json`. It does not accept
204`wrangler.toml`.
205
206The `name` value must contain 1 to 63 lowercase ASCII letters, digits, or
207internal hyphens. It cannot start or end with a hyphen.
208
209The deployment accepts these top-level keys:
210
211- `$schema`, `name`, `main`, and `no_bundle`
212- `compatibility_date` and `compatibility_flags`
213- `durable_objects` and `migrations`
214- `assets`, `services`, `triggers`, and `vars`
215- `d1_databases`, `kv_namespaces`, `queues`, `workflows`, and
216 `r2_buckets`
217- `worker_loaders` and `containers`
218- `define` and `rules`
219
220Each other top-level key, including `routes`, stops the deployment.
221
222`celld deploy` bundles with esbuild, and it gives `define` and `rules` to that
223run. Each `define` value is a JavaScript expression, as it is for Wrangler.
224A rule must have a `type` of `Text`, `Data`, or `CompiledWasm`, and each of its
225globs must have the form `**/*.ext` or `*.ext`: esbuild selects a loader by
226file extension, so celld refuses a glob that selects a different set of files.
227
228Two rules can name one extension only if they give it the same type. Two rules
229that give one extension different types stop the deployment, because no single
230loader satisfies both. celld applies a `CompiledWasm` rule to `**/*.wasm`
231already, so a `CompiledWasm` rule for that extension agrees with the built-in
232rule and the deployment continues. Another type for `**/*.wasm` stops the
233deployment.
234
235`no_bundle` does not run esbuild. A config that sets `no_bundle` with `define`
236or `rules` therefore stops the deployment.
237
238An asset-only project can omit `main`. The native deploy command refuses an
239unsafe asset path, and `.assetsignore` requires Wrangler.
240
241See [Limitations](limitations.md) for the operating-system, networking,
242security, pressure, and update boundaries.