Skip to content
Playground(another site)

bynk.cloudflare.edge_cache_in_schedule

Error An on schedule handler reaches an EdgeCache instance; a cron run's purge is accepted but clears nothing from the fetch cache, so purge from a service handler.

A purge reaches the edge cache only from the Worker's own fetch. Cloudflare accepts a purge from a cron run, but it clears nothing from the cache that fetch serves, so the stale responses would stay. An on schedule handler that reaches EdgeCache, with given Edge or through a provider that does, is refused. Purge from a service handler instead. An agent and a queue consumer have the same rule: bynk.cloudflare.edge_cache_in_agent, bynk.cloudflare.edge_cache_in_queue.

Example

capability Edge = EdgeCache
service sweep from cron {
on schedule("0 * * * *") () -> Effect[Result[(), String]] given Edge { // ✗ a cron purge clears nothing
let purged <- Edge.purge(["/dl/"])
if purged { Ok(()) } else { Err("refused") }
}
}
service operator from http {
on POST("/purge/:hex") (hex: String) -> Effect[HttpResult[Bool]] by v: Visitor given Edge { // ✓ purge from a service handler
let purged <- Edge.purge(["/dl/\(hex)"])
Ok(purged)
}
}

In the Book

See also

  • Every code in its category, Cloudflare, on the diagnostic index.
  • bynk explain bynk.cloudflare.edge_cache_in_schedule shows the same from the installed toolchain, without a network.