Skip to content
Playground(another site)

bynk.http.cf_wrong_type

Error An HTTP handler's cf parameter is not typed RequestCf.

cf is the name the router reserves for what Cloudflare derived about the request's connection (its country, colo, ASN and the like), so a parameter called cf must be typed RequestCf, the record from bynk.cloudflare whose fields are all optional. Any other type has nothing to be filled from. Retype the parameter and import the type with consumes bynk.cloudflare { RequestCf }; that import is also what locks the deployment unit to Cloudflare. An input of your own needs another name, and a name that is neither a path parameter nor one of the reserved ones is bynk.http.extra_param. A :cf path segment stays a path parameter.

Example

on GET("/hello") (cf: String) -> Effect[HttpResult[String]] by v: Visitor { … } // ✗
on GET("/hello") (cf: RequestCf) -> 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.cf_wrong_type shows the same from the installed toolchain, without a network.