Skip to content
Playground(another site)

bynk.asset.shadows_route

Error A fixed asset path equals a literal HTTP route, in the same context or in another member of the same [deploy.workers.<key>] group, which the platform-served asset makes unreachable.

The platform answers a fixed asset's path before the Worker runs, and it does so for every method, so an HTTP handler at exactly that path can never be reached. The compiler refuses it rather than ship a route that never runs. Move the route, or give the asset another path. A route with a parameter that matches the asset's path, such as /:page, still serves every other path, and is only the warning bynk.asset.may_shadow_route. The members of a [deploy.workers.<key>] group share one assets directory, so an asset in one member shadows a route of the same path in another.

Example

asset favicon = "assets/favicon.ico" at "/favicon.ico"
service web from http {
on GET("/favicon.ico") () -> Effect[HttpResult[String]] by Visitor { // ✗ the asset answers first
Ok("never reached")
}
}
service web from http {
on GET("/health") () -> Effect[HttpResult[String]] by Visitor { // ✓
Ok("ok")
}
}

In the Book

See also

  • Every code in its category, Static assets, on the diagnostic index.
  • bynk explain bynk.asset.shadows_route shows the same from the installed toolchain, without a network.