bynk.context.consumes_cycle
Error Contexts form a consumes dependency cycle.
Contexts may not form a circle of consumes clauses, whether directly or through others. bynk deploy takes the order in which to upload the Workers from the consumes clauses, because Cloudflare resolves a Service Binding when a Worker is uploaded and so the callee must already exist; a cycle has no such order. The error names the cycle and sits on one of its clauses. Remove one clause: usually the callee takes what it needs as an argument instead of calling back. Logic both contexts need can move into a commons that each uses.
Example
context a
consumes b // ✗ `a` and `b` consume each other (reported on one clause)
// b.bynkcontext b
consumes a // ✗
service quote { // ✓ no `consumes a`: `quote` takes `rate` as an argument on call(rate: Int) -> Effect[Int] by Caller { Effect.pure(rate * 2) }}In the Book
See also
- Every code in its category, Contexts, on the diagnostic index.
bynk explain bynk.context.consumes_cycleshows the same from the installed toolchain, without a network.