Skip to main content

phase_workers_ws_open_split

Function phase_workers_ws_open_split 

Source
pub fn phase_workers_ws_open_split(
    target: BuildTarget,
    parsed: &[ParsedFile],
    groups: &BTreeMap<String, Vec<usize>>,
    kinds: &BTreeMap<String, UnitKind>,
    unit_tables: &HashMap<String, UnitTable>,
    errors: &mut ErrorSink,
)
Expand description

#2306: on the Workers target, a from websocket service’s on open is hosted inside the Durable Object of the agent it transfers the connection to, and that method is emitted from the file the service and agent share. A context split across several files is emitted one file at a time, so a transfer into an agent declared in a different file than the service was routed to the agent’s Durable Object (compose.ts forwards the upgrade) but never hosted there: the upgrade returned 404. Reject it at compile time instead. On the bundle target the open is an ordinary surface method and the layout works, so the check is Workers-only, like phase_workers_unprovided_capabilities.