Skip to main content

phase_asset_routes

Function phase_asset_routes 

Source
pub fn phase_asset_routes(
    parsed: &[ParsedFile],
    groups: &BTreeMap<String, Vec<usize>>,
    kinds: &BTreeMap<String, UnitKind>,
    unit_uses: &HashMap<String, Vec<String>>,
    errors: &mut ErrorSink,
)
Expand description

#1883, slice 2 ([DECISION C]): fixed asset paths against each Worker’s routes. For every context, over the assets its uses closure declares with an at path:

  • two different files at one fixed path is bynk.asset.path_conflict;
  • a fixed path equal to one of the context’s literal HTTP routes is bynk.asset.shadows_route: the platform answers that path before the Worker runs, for every method (a POST gets the platform’s 405, checked against wrangler dev 4.107.0), so the handler is unreachable;
  • a fixed path a parameterised route matches (/:name) is the warning bynk.asset.may_shadow_route: the route still serves every other path.

Content-hashed paths need no check here: handlers may not use the /_assets/ prefix at all (bynk.http.reserved_prefix).