-
Notifications
You must be signed in to change notification settings - Fork 60
Open
Labels
wontfixThis will not be worked onThis will not be worked on
Description
I tried to add support for triggers on agent component tables by following the convex-helpers Triggers
docs. The setup works when I register triggers inside the agent component package itself, but it does not work when I expose triggers
and register them in example apps.
I’d like help understanding why this discrepancy happens and how to fix it.
Steps Taken
- Added
triggers.ts
with the following code:
import { mutation as rawMutation, internalMutation as rawInternalMutation } from "./_generated/server.js";
import type { DataModel } from "./_generated/dataModel.js";
import { Triggers } from "convex-helpers/server/triggers";
import { customCtx, customMutation } from "convex-helpers/server/customFunctions";
const triggers: Triggers<DataModel> = new Triggers<DataModel>();
export const mutation = customMutation(rawMutation, customCtx(triggers.wrapDB));
export const internalMutation = customMutation(
rawInternalMutation,
customCtx(triggers.wrapDB),
);
export { triggers };
- Updated all mutations to use this new
mutation
wrapper.
Problem
- ✅ Triggers work fine when registered inside the agent component package.
- ❌ Triggers do not fire when I expose
triggers
and register them in example apps.
Question
What could be causing triggers to fail when registered outside the component package?
Metadata
Metadata
Assignees
Labels
wontfixThis will not be worked onThis will not be worked on