Skip to content

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

@aribn

Description

@aribn

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<string, Function> 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.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Status

    Untriaged

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions