bynk.parse.handler_in_agent
Error A protocol handler (on GET/schedule/message) was declared in an agent.
An agent has only on call handlers. HTTP routes (on GET, on POST, …), schedules and queue messages belong on a service, which receives the request or event and calls the agent. Move the protocol handler to a service and give the agent an on call operation for it to call.
Example
agent Tally { key id: String store count: Cell[Int]
on GET("/count") () -> Effect[Result[Int, String]] { // ✗ a route is a service's Ok(count) }}
agent Tally { key id: String store count: Cell[Int]
on call get() -> Effect[Result[Int, String]] { // ✓ the agent's own operation Ok(count) }}In the Book
See also
- The grammar rule it governs:
handler. - Every code in its category, Parser, on the diagnostic index.
bynk explain bynk.parse.handler_in_agentshows the same from the installed toolchain, without a network.