Runtime APIs
Fetch events
Your Worker's fetch() handler runs unchanged on OpenOrange, with a new execution context for each request for waitUntil(), props, and exports.
Runs on Node.js runtime with workerd-shaped globals, cloudflare:* and node:* modules
- Works
fetch(request, env, ctx),ctx.waitUntil(),ctx.props,ctx.exports,WorkerEntrypoint, andenvandexportsfromcloudflare:workers- Differs
passThroughOnException()does nothing,ctx.abort()cannot stop running code, andrequest.cfholds placeholder values- Missing
ctx.cache,ctx.access, and real trace spans inctx.tracing- Migration
- Not needed A Worker holds no data. Deploy its code to Orange.
- Scales by
- Runner count
Your Worker’s fetch(request, env, ctx) handler runs unchanged on OpenOrange.
Orange calls it once for each request, with a new ctx each time, as
Cloudflare does.
Quickstart
-
Configure the Worker
Point
mainat the file that exports the handler.{ "name": "hello", "main": "src/index.ts", "compatibility_date": "2026-09-03" } -
Write the handler
Export
fetchon the default object, as on Cloudflare.export default { async fetch(request, env, ctx): Promise<Response> { // Runs after the response is sent. ctx.waitUntil(fetch("https://example.com/log", { method: "POST", body: request.url })); return new Response(`Hello from ${new URL(request.url).pathname}`); }, } satisfies ExportedHandler<Env>; -
Run it
orange devCall it on port 8787:
curl localhost:8787/hello Hello from /hello
How it works
ctx.waitUntil(promise)keeps work running after the response.orange devprints each promise that rejects.ctx.propsandctx.exportswork as on Cloudflare. A default class that extendsWorkerEntrypointgets a new instance for each request.request.urlis the URL the client used, built from itsHostheader.
AI context Compatibility, limits and details
Written for LLMs and coding agents: every edge case, measurement, and known deviation. You do not need it to use the feature.
Compatibility
| Feature | Status | Notes |
|---|---|---|
The fetch event | Partial | The handler runs unchanged. The context members below that are Partial or Not supported make the event Partial. |
ctx.waitUntil(promise) | Supported | Orange waits for every registered promise, including work registered while an earlier promise is settling, and keeps both fulfilled and rejected outcomes. |
ctx.props | Supported | The props of the service binding that called this entrypoint. See Multiple Workers. An empty object when the caller passes no props, as in workerd. |
ctx.exports | Supported | This Worker’s named WorkerEntrypoint classes and handler objects become service stubs. Durable Object classes appear as their namespaces. |
ctx.passThroughOnException() | Partial | A no-op. See Deviations. |
ctx.abort(reason) | Partial | Releases the context’s I/O objects, then throws. See Deviations. |
ctx.tracing | Partial | No-op spans. See Deviations. |
ctx.cache and ctx.access | Not supported | undefined, as in local workerd. |
env and exports from cloudflare:workers | Supported | Follow workerd. See cloudflare:workers. |
withEnv(), withExports(), and withEnvAndExports() | Supported | Override the importable env and exports for a callback. |
waitUntil() from cloudflare:workers | Supported | Registers the promise on the running event. At module scope it throws workerd’s Disallowed operation called within global scope error. |
WorkerEntrypoint | Supported | A base class that stores ctx and env. |
The disallow_importable_env flag | Not supported | Orange does not read it. |
Copying every ctx property, as Sentry does, works: ctx.cache reads as
undefined instead of throwing.
Limits
Orange does not copy Cloudflare’s per-request limits, such as CPU time or how
long waitUntil() work runs after the response. Nothing in the runtime times
out a handler or its waitUntil() promises. For the limits of the machine and
of Rivet, see Limits.
Handlers
- The default export’s
fetchhandles each request. A default class that extendsWorkerEntrypointhandles each request with a new instance. - A Worker that also exports
scheduled,queue, or other handlers still servesfetch. Each other handler has its own dispatch. - A Worker without a
fetchhandler loads, and each request fails withHandler does not export a fetch() function., as in workerd. - A module without a default export serves only its named entrypoints.
- A default export that is not an object or a
WorkerEntrypointclass fails withWorker entrypoint must have a default object export.
Responses
The handler must return an OpenOrange Response. The request fails when:
| What the handler returns | Error |
|---|---|
Something that is not a Response | TypeError: Worker fetch handler must return a Response |
Response.error() | TypeError: Return value from serve handler must not be an error response (like Response.error()) |
A Response whose body was already read | TypeError: Body has already been used. It can only be used once. Use tee() first if you need to read it twice. |
A handler that throws fails the request with a 500 response. Its waitUntil()
work still settles first.
Through a service binding or a Durable Object stub, the caller’s fetch()
rejects with workerd’s remote error instead. A missing handler gives
Handler does not export a fetch() function., a result that is not a
Response gives
TypeError: Incorrect type for Promise: the Promise did not resolve to 'Response'.,
and a thrown error keeps its name, message, and own properties, such as code.
Requests
request.urluses the request’sHostheader. Underorange serve, its scheme ishttps:when the cluster’s gateway sendsX-Forwarded-Proto: https, so a Worker sees the URL its client used, as on Cloudflare.orange devtakes requests directly and ignores that header.request.cfis the placeholder object that Miniflare uses when it cannot download the real one, such ascolo: "DFW"andcity: "Austin", withhttpProtocolset from the request. It is the same underorange devandorange serve.- Orange sets
CF-Connecting-IPto the client’s address, unless the request already has one, as Miniflare does.
cloudflare:workers
- The
env,exports,withEnv(),withExports(), andwithEnvAndExports()exports follow workerd. envis readable while the Worker module evaluates.- Both proxies follow the current async-context override.
- Changes through
envchange the environment object passed to handlers. exportsis the same object asctx.exports.
How Orange runs the handler
- The controlled loader builds an extensible environment from the configured bindings, installs the Cloudflare global manifest, imports the Worker, and keeps its named exports.
- Dispatch calls the default module Worker’s
fetchhandler inside the request’s execution context. - The dispatch result holds the response and a promise for every
waitUntil()outcome. - In development, a dedicated Node.js child process owns the HTTP listener and the runtime lifecycle. It streams request and response bodies and runs each request inside the child.
- The child reports readiness, startup failures, request failures, background failures, signals, and a clean shutdown to the parent CLI over IPC.
- The child returns background outcomes to the runtime, which reports each
rejected one to the CLI for local diagnostics.
orange devprints it as an error with its stack.
Deviations
passThroughOnException()is a no-op, because Orange has no origin to fall back to. An exception after the call still fails the request with a 500 response.abort()releases the context’s I/O objects, such as RPC stubs, and then throws the reason, because Node.js cannot stop running JavaScript. Without a reason it throwsWorker execution was aborted due to call to ctx.abort().ctx.cacheandctx.accessareundefined, as in local workerd.ctx.tracingruns every span callback with a no-op span whoseisTracedisfalse, because Orange has no trace collector.request.cfholds placeholder values, not the client’s location.
Conformance
- The conformance check compiles a module Worker against the pinned
ExportedHandler<Env>fetch signature, and proves that an invalid response type is rejected. - The generated event registry check verifies that the context has exactly the
Cloudflare
ExecutionContextkeys, and that it is assignable to its generic contract. - Runtime tests cover entrypoint ordering, named exports, environment
injection, response validation,
waitUntil()draining, each unsupported API, and the dedicated process lifecycle over a real HTTP socket. tests/events/execution-context.test.tsruns Workers underorange devand checks a missing, throwing, or non-Responsehandler,passThroughOnException(),ctx.propswith and withoutprops, and copying everyctxproperty.
Recorded results from the conformance run of 2026-11-10 (Orange ea40348), 1,670 of 1,851 tests passing across every area. Each check is works when every result passed and partial when some did. The full feature matrix is on the compatibility page.
Workers
| Check | Status | Results |
|---|