#602·flue

@flue/vite adds DO class to wrangler config but does not export it in the bundle

Author: imielvisserCreated Aug 13, 2026Updated Sep 14, 2026

Package: @flue/[email protected] Related: @flue/[email protected], @cloudflare/[email protected], [email protected] Repo: https://github.com/withastro/flue

Environment

Summary

The Flue Vite plugin correctly adds a FlueBrowserAssistantAgent Durable Object binding and migration entry to the generated dist/.../wrangler.json, but does not generate or export the corresponding DO class in the bundled index.js. This causes wrangler deploy to fail with error code 10070.

Steps to reproduce

  1. Clone https://github.com/jillesme/talk-to-webpage (which uses @flue/vite + @flue/runtime)
  2. Run pnpm install && pnpm build
  3. Run npx wrangler deploy

Expected behavior

The Vite build should either:

  • Generate and export a FlueBrowserAssistantAgent DO class in the bundle entry point, matching the migration/binding it adds to the generated wrangler config
  • Or not add the class to the generated wrangler config if it cannot generate the export

Actual behavior

The generated dist/voice_imiel_dev/wrangler.json contains:

json
{
  "durable_objects": {
    "bindings": [
      { "name": "FLUE_BROWSER_ASSISTANT_AGENT", "class_name": "FlueBrowserAssistantAgent" }
    ]
  },
  "migrations": [
    { "tag": "v1", "new_sqlite_classes": ["FlueBrowserAssistantAgent"] }
  ]
}

But the bundled index.js only exports:

javascript
export { BrowserSession, WebsiteVoiceAgent, worker_entry_default as default };

FlueBrowserAssistantAgent is not present in the bundle at all:

$ grep "FlueBrowserAssistantAgent" dist/voice_imiel_dev/index.js
(no output)

The Flue runtime does register the agent function via __flueBindAgentModule(BrowserAssistant, { identity: "browser-assistant" }) (line 65731), and the naming convention Flue + PascalCase(browser-assistant) + Agent = FlueBrowserAssistantAgent is correctly applied to the wrangler config. But the corresponding class FlueBrowserAssistantAgent extends Server (or equivalent) is never generated or added to the bundle exports.

Deploy fails with:

[ERROR] Cannot apply new-class migration to class 'FlueBrowserAssistantAgent'
that is not exported by script. [code: 10070]

Deleting the Worker and redeploying produces the same error (this is not a stale migration issue).

Workaround (verified)

Manually create and export the DO class in cloudflare.ts using the same factory the virtual entry would use:

typescript
// cloudflare.ts
export { default } from './app.ts';
export { BrowserSession } from './browser/browser-session.ts';
export { WebsiteVoiceAgent } from './voice/website-voice-agent.ts';

// Workaround: @flue/vite adds FlueBrowserAssistantAgent to wrangler config
// but doesn't export the class in the bundle.
import { Agent } from 'agents';
import { createFlueAgentClass } from '@flue/runtime/cloudflare/internal';
import { createCloudflareAgentRuntime } from '@flue/runtime/internal';

export const FlueBrowserAssistantAgent = createFlueAgentClass({
  AgentBase: Agent,
  runtime: createCloudflareAgentRuntime(),
  className: 'FlueBrowserAssistantAgent',
  agentName: 'browser-assistant',  // matches the identity in __flueBindAgentModule
  extension: undefined,
});

This mirrors exactly what the generated virtual:flue/worker entry is supposed to produce. Deploy succeeds with this in place.