Skip to content
Playground(another site)

bynk.deploy.worker_cycle

Error Workers bind to each other in a cycle that involves a [deploy.workers.<key>] group: a group folds its members into one Worker, which can close a cycle among contexts that are themselves acyclic. A Worker is uploaded after the Workers it binds to, so the cycle cannot be deployed.

bynk deploy uploads each Worker after the Workers it binds to, since a Service Binding must name a script that already exists. So the Workers' bindings must run one way: a cycle has no order to deploy in. Contexts cannot consume each other in a cycle (that is bynk.context.consumes_cycle), but a [deploy.workers.<key>] group folds its members into one Worker, and that can close a cycle among contexts that have none: if a member of front calls a member of back, and another member of back calls a member of front, the two Workers bind to each other. Move a context out of its group, or into the other, so the calls between Workers run one way. A publisher's Worker also binds to its subscribers, so a subscriber that calls its publisher can close a cycle too.

Example

bynk.toml
[deploy.workers.front]
contexts = ["shop.web", "shop.prices"]
[deploy.workers.back]
contexts = ["shop.stock", "shop.reports"]
// shop/web.bynk
consumes shop.stock
// shop/reports.bynk
context shop.reports // ✗ `back` binds to `front`, and `front` to `back`
consumes shop.prices
// bynk.toml
[deploy.workers.front]
contexts = ["shop.web"] // ✓
[deploy.workers.back]
contexts = ["shop.stock", "shop.reports", "shop.prices"] // ✓ calls run from `front` to `back` only

In the Book

See also

  • Every code in its category, Deployment, on the diagnostic index.
  • bynk explain bynk.deploy.worker_cycle shows the same from the installed toolchain, without a network.