Skip to content
Playground(another site)

bynk.http.json_on_non_http

Error A @json annotation is placed on a handler that is not on http.

@json(options: …) picks how one HTTP response body writes Option, tagged or plain. Only an on http handler answers with a response body, so the annotation is refused on a schedule, queue or other handler. Move it to an HTTP route, or remove it. The service-wide section, json { }, is limited to from http services too: bynk.http.json_not_http.

Example

service jobs from cron {
@json(options: plain) // ✗ a schedule has no response body
on schedule("0 0 * * *") () -> Effect[Result[(), String]] { … }
}
service api from http {
@json(options: plain) // ✓
on GET("/activity") () -> Effect[HttpResult[String]] by v: Visitor { … }
}

In the Book

See also

  • Every code in its category, HTTP, on the diagnostic index.
  • bynk explain bynk.http.json_on_non_http shows the same from the installed toolchain, without a network.