cloudflare / cloudflare/workers-sdk

DynamicWorkerExecutor RPC tool proxy returns empty objects in local dev (Miniflare)

Open
#13,263 0 comments 0 reactions 2 assignees Claimed by @MattieTK View on GitHub
package:miniflare
Dominant language
TypeScript
Stars
4.5k
Forks
1.5k
Avg merge
3d 8h
Merged PRs (30d)
187

Description

### What versions & operating system are you using?

- macOS 14 (arm64)
- Node 20.19.4
- wrangler 4.80.0
- @cloudflare/codemode 0.3.3
- miniflare 4.20260317.2 (via @cloudflare/vite-plugin 1.30.1)

### Please provide a link to a minimal reproduction

https://github.com/aribn/cloudflare-rpc-repro

### Describe the Bug

## DynamicWorkerExecutor RPC tool proxy returns empty objects in local dev (Miniflare)

I'm building an AI chat tool that uses `@cloudflare/codemode` to execute AI-generated JavaScript in a sandboxed Dynamic Worker, with RPC-proxied tool functions callable from within the sandbox.

**What works locally:** Code execution, `data` variable injection via code string, console log capture — all fine.

**What doesn't work:** Tool functions passed via `ResolvedProvider[]` are never called. Calls to `codemode.get_step(...)` from within the sandbox return `{}` instead of actual data. Parent-side functions never execute.

I also tried the `Record` format (which logged the deprecation warning `Passing raw fns to executor.execute() is deprecated. Use ResolvedProvider[] instead.`) — same result.

On some attempts, the RPC setup causes a **segfault** (`Received signal #11: Segmentation fault: 11`) in Miniflare.

```typescript
const executor = new DynamicWorkerExecutor({
loader: env.LOADER, // exists, type: object
timeout: 30000,
globalOutbound: null
});

// Tools are never called — sandbox receives {} for each call
const result = await executor.execute(normalizedCode, [{
name: 'codemode',
fns: {
get_step: async (args) => {
console.log('called'); // never appears
return workerGetStep(args.name, formState);
}
}
}]);
```

**Workaround:** Passing `[]` as providers and injecting all data directly into the code string works. But this means we can't use RPC callbacks for operations that need parent-worker access (DB queries, API calls).

**Environment:** macOS, wrangler 4.80.0, `@cloudflare/codemode` 0.3.3, `@cloudflare/vite-plugin`, `worker_loaders` binding

### Please provide any relevant error logs

[wrangler-2026-04-04_00-02-42_201.log](https://github.com/user-attachments/files/26474162/wrangler-2026-04-04_00-02-42_201.log)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.