Skip to content
Playground(another site)

bynk.cloudflare.edge_cache_exported

Error An exported capability reaches an EdgeCache instance through its provider's given; a consuming context would build it in its own Worker, whose purge misses this one's cache.

A capability you export is built by each context that consumes it, in that context's own Worker. A provider that reaches EdgeCache would purge from there, and a purge reaches only the cache of the Worker it runs in, so this context's cache would keep the stale response. Keep the capability inside the context and have a service route do the purge, which another context can reach by calling that service.

Example

exports capability { Takedown }
capability Edge = EdgeCache
capability Takedown { // ✗ exported, but its provider purges through `Edge`
fn take(path: String) -> Effect[Bool]
}
provides Takedown = Purging given Edge {
fn take(path: String) -> Effect[Bool] {
Edge.purge([path])
}
}
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_exported shows the same from the installed toolchain, without a network.