Skip to content
Playground(another site)

bynk.actor.missing_by_on_http

Error An HTTP handler lacks the required by actor clause.

An HTTP handler can be reached by anyone, and Bynk has no safe default for who is calling, so each one must say, with a by clause, which actor it expects. The compiler then emits the verification before the body runs. A public route writes by v: Visitor; an authenticated one names an actor it declares. Set it once on the header, service api from http by Visitor, and every handler without its own by inherits it. A WebSocket on open handler needs one too. call handlers need one too (bynk.actor.missing_by_on_call); cron and queue have a default.

Example

service api from http {
on GET("/health") () -> Effect[HttpResult[String]] { // ✗ who may call this?
Ok("up")
}
}
service api from http {
on GET("/health") () -> Effect[HttpResult[String]] by v: Visitor { // ✓ anyone, said outright
Ok("up")
}
}

In the Book

See also

  • Every code in its category, Actors, on the diagnostic index.
  • bynk explain bynk.actor.missing_by_on_http shows the same from the installed toolchain, without a network.