Skip to content
Playground(another site)

bynk.capability.derived_outside_context

Error A derived capability was declared outside a context.

A derived capability is an instance of a platform resource, and the resource's data belongs to a context. An adapter only describes a boundary to foreign code, so it has no data to own. Declare the instance in a context that selects the base with consumes.

Example

adapter cache {
binding "./cache.binding.ts"
consumes bynk.cloudflare { Kv }
capability Sessions = Kv // ✗ an adapter cannot own an instance
}
context cache {
consumes bynk.cloudflare { Kv }
capability Sessions = Kv // ✓ a context owns its data
}

In the Book

See also

  • The grammar rule it governs: capability_decl.
  • Every code in its category, Capabilities, on the diagnostic index.
  • bynk explain bynk.capability.derived_outside_context shows the same from the installed toolchain, without a network.