Skip to content

fix(cli): route node-target serve through @flue/runtime/node#197

Closed
k161196 wants to merge 1 commit into
withastro:mainfrom
k161196:fix/node-target-websocket-upgrade
Closed

fix(cli): route node-target serve through @flue/runtime/node#197
k161196 wants to merge 1 commit into
withastro:mainfrom
k161196:fix/node-target-websocket-upgrade

Conversation

@k161196
Copy link
Copy Markdown

@k161196 k161196 commented Jun 3, 2026

Node-target builds returned HTTP 500 on every WebSocket upgrade to /agents/:name/:id. Cause: dual-instance Symbol mismatch.

  • @flue/cli bundled @hono/node-server into generated dist/server.mjs; the bundled copy attached WAIT_FOR_WEBSOCKET_SYMBOL on env.
  • Generated entry also imported createNodeWebSocketTransport from @flue/runtime/node (external), which re-imported upgradeWebSocket from the disk copy of @hono/node-server.
  • Two module instances => two distinct Symbol identities. injectWebSocket wrote symbol A; upgradeWebSocket read symbol B => undefined => new Response(null, { status: 500 }). Same dual-copy applied to ws.

Fix: re-export serve from @flue/runtime/node and import it (plus createNodeWebSocketTransport) through that single entry in the generated server. Mark @hono/node-server and ws external in the node-target bundler so any future imports also share the disk copy. Update dev test fixture to symlink the now-external deps so the generated server can resolve them.

Verified end-to-end: handshake 500 -> 101, SDK client streams events.

Node-target builds returned HTTP 500 on every WebSocket upgrade to
`/agents/:name/:id`. Cause: dual-instance Symbol mismatch.

- @flue/cli bundled @hono/node-server into generated dist/server.mjs;
  the bundled copy attached WAIT_FOR_WEBSOCKET_SYMBOL on env.
- Generated entry also imported createNodeWebSocketTransport from
  @flue/runtime/node (external), which re-imported upgradeWebSocket
  from the disk copy of @hono/node-server.
- Two module instances => two distinct Symbol identities. injectWebSocket
  wrote symbol A; upgradeWebSocket read symbol B => undefined =>
  `new Response(null, { status: 500 })`. Same dual-copy applied to ws.

Fix: re-export `serve` from @flue/runtime/node and import it (plus
createNodeWebSocketTransport) through that single entry in the generated
server. Mark @hono/node-server and ws external in the node-target
bundler so any future imports also share the disk copy. Update dev
test fixture to symlink the now-external deps so the generated server
can resolve them.

Verified end-to-end: handshake 500 -> 101, SDK client streams events.
@astrobot-houston
Copy link
Copy Markdown

Thanks for the contribution! We're closing this PR and moving the conversation to the issue: #198

We've moved to a model where bugs and feature proposals are discussed in issues/discussions before code review, so the community can help prioritize and shape the work. Your branch is linked from the new thread so the implementation isn't lost — please join us there to continue the conversation.

— astrobot 🤖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants