@flue/vite adds DO class to wrangler config but does not export it in the bundle
Package: @flue/[email protected]
Related: @flue/[email protected], @cloudflare/[email protected], [email protected]
Repo: https://github.com/withastro/flue
Environment
- macOS
- Node 22
- pnpm 11.10.0
@flue/[email protected]@flue/[email protected]@cloudflare/[email protected][email protected][email protected]compatibility_date: "2026-08-13"
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
- Clone https://github.com/jillesme/talk-to-webpage (which uses
@flue/vite+@flue/runtime) - Run
pnpm install && pnpm build - Run
npx wrangler deploy
Expected behavior
The Vite build should either:
- Generate and export a
FlueBrowserAssistantAgentDO 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:
{
"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:
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:
// 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.
Source: withastro/flue