Summary
Following the README's worker-shell quick start verbatim produces a runtime failure on the first exec, with an error naming a symbol the reader never wrote:
TypeError: Cannot read properties of undefined (reading 'WorkspaceServiceProxy')
There are two independent causes, and they produce the identical message. That's what makes this expensive: fixing one gives no signal you made progress, because the error doesn't change.
- The Worker doesn't re-export the class —
export { WorkspaceServiceProxy } from "@cloudflare/computer"
compatibility_flags is missing enable_ctx_exports, so ctx.exports is undefined
Cause 2 appears to be undocumented. The README's worker-shell section lists nodejs_compat and experimental and the Worker Loader binding, but not enable_ctx_exports. I found the flag name by grepping strings out of the workerd binary.
The failing read is backends/worker-shell/index.js:
env: { HOST: ctx.exports.WorkspaceServiceProxy({ props: workspace }) },
ctx.exports is gated behind enable_ctx_exports; without the flag the property access throws before WorkspaceServiceProxy is ever consulted — hence the misleading symbol name in the message.
Reproduce
@cloudflare/computer@0.2.0, wrangler@4.123.0, workerd@1.20260811.1.
Build the README's worker-shell quick start exactly as written, then:
curl -X POST localhost:8787/exec -H 'content-type: application/json' -d '{"cmd":"echo hi"}'
Expected: hi
Actual: TypeError: Cannot read properties of undefined (reading 'WorkspaceServiceProxy')
Adding enable_ctx_exports to compatibility_flags fixes it, provided the class is also re-exported.
Suggested fix
Either would have saved the debugging time; the first is the cheap one:
- Document the flag. Add
enable_ctx_exports to the worker-shell setup section and the "Choosing a backend" table's Needs column, alongside the experimental flag and Worker Loader binding.
- Fail with a message that names the cause. Guard the
ctx.exports access and throw something that distinguishes the two cases, e.g. "ctx.exports is undefined — add enable_ctx_exports to compatibility_flags" vs "WorkspaceServiceProxy is not exported from your Worker — add export { WorkspaceServiceProxy }".
Happy to open a PR for the docs change if useful.
Context
Hit while building a local rig against the isolate backend. Everything else worked well once past this — persistent filesystem across restarts, shell exec, shared store between fs and the shell, and egress control were all straightforward.
Summary
Following the README's worker-shell quick start verbatim produces a runtime failure on the first
exec, with an error naming a symbol the reader never wrote:There are two independent causes, and they produce the identical message. That's what makes this expensive: fixing one gives no signal you made progress, because the error doesn't change.
export { WorkspaceServiceProxy } from "@cloudflare/computer"compatibility_flagsis missingenable_ctx_exports, soctx.exportsisundefinedCause 2 appears to be undocumented. The README's worker-shell section lists
nodejs_compatandexperimentaland the Worker Loader binding, but notenable_ctx_exports. I found the flag name by grepping strings out of theworkerdbinary.The failing read is
backends/worker-shell/index.js:ctx.exportsis gated behindenable_ctx_exports; without the flag the property access throws beforeWorkspaceServiceProxyis ever consulted — hence the misleading symbol name in the message.Reproduce
@cloudflare/computer@0.2.0,wrangler@4.123.0,workerd@1.20260811.1.Build the README's worker-shell quick start exactly as written, then:
Expected:
hiActual:
TypeError: Cannot read properties of undefined (reading 'WorkspaceServiceProxy')Adding
enable_ctx_exportstocompatibility_flagsfixes it, provided the class is also re-exported.Suggested fix
Either would have saved the debugging time; the first is the cheap one:
enable_ctx_exportsto the worker-shell setup section and the "Choosing a backend" table's Needs column, alongside theexperimentalflag and Worker Loader binding.ctx.exportsaccess and throw something that distinguishes the two cases, e.g. "ctx.exports is undefined — addenable_ctx_exportsto compatibility_flags" vs "WorkspaceServiceProxy is not exported from your Worker — addexport { WorkspaceServiceProxy }".Happy to open a PR for the docs change if useful.
Context
Hit while building a local rig against the isolate backend. Everything else worked well once past this — persistent filesystem across restarts, shell exec, shared store between
fsand the shell, and egress control were all straightforward.