Skip to content

Function: require()

require<F>(ctx, factory, caller?): InstanceType<ReturnType<F>["plugin"]>

Like instance but throws when the plugin is not registered. Use for siblings whose absence is a wiring bug rather than a runtime condition (e.g. requiring lakebase when the caller has storage / memory enabled).

caller is prepended to the error message so cross-plugin failures are easy to attribute in logs.

F extends PluginDataFactory

PluginContextLike | undefined

F

string | NameLike

InstanceType<ReturnType<F>["plugin"]>

import { lakebase } from "@databricks/appkit";
import { plugin } from "@dbx-tools/appkit";
const pool = plugin.require(this.context, lakebase, "mastra").exports().pool;