Skip to content
Playground(another site)

bynk.http.cookies_not_http

Error A RequestCookies appears on a handler that is not an HTTP route.

RequestCookies is the cookies of an HTTP request, read from its Cookie header. A cron or other handler that is not an on http route answers no request, so there are no cookies for it to take, and the parameter is refused. Remove it, or move the work into an HTTP handler. On an HTTP route, cookies is a record or RequestCookies and nothing else: bynk.http.cookies_wrong_type. RequestQuery has the same rule: bynk.http.query_not_http.

Example

service ticker from cron {
on schedule("*/5 * * * *") (cookies: RequestCookies) -> Effect[Result[(), String]] { … } // ✗ no request
}
type Session = { sid: Option[String] }
service ticker from http {
on GET("/me") (cookies: Session) -> Effect[HttpResult[String]] by v: Visitor { … } // ✓
}

In the Book

See also

  • The grammar rule it governs: http_handler.
  • Every code in its category, HTTP, on the diagnostic index.
  • bynk explain bynk.http.cookies_not_http shows the same from the installed toolchain, without a network.