Skip to content
Playground(another site)

bynk.http.json_not_http

Error A json { } policy appears on a service that is not from http.

A json { } section chooses how a service's HTTP response bodies write Option, tagged or plain. Only a from http service has response bodies, so on a cron or other service the section is refused. Move it to the HTTP service it was meant for, or delete it. The cors, security and limits sections have the same rule: bynk.http.cors_not_http, bynk.http.security_not_http, bynk.http.limits_not_http. For the per-route form, see bynk.http.json_on_non_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("/items") () -> 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_not_http shows the same from the installed toolchain, without a network.