AmaanDevelopsA
Convex Community2mo ago
2 replies
AmaanDevelops

Better Auth triggers with Convex

Advice🔑AuthResolved🧩component
I’m trying to use Better Auth triggers with Convex, following the docs here: https://labs.convex.dev/better-auth/features/triggers

The examples show:

import { components, internal } from "./_generated/api";
import { createClient, type AuthFunctions } from "@convex-dev/better-auth";

const authFunctions: AuthFunctions = internal.auth;

export const authComponent = createClient<DataModel>(components.betterAuth, {
authFunctions,
triggers: {
user: {
onCreate: async (ctx, doc) => { /* ... */ },
},
},
});
In my project, internal.auth doesn’t exist in ./_generated/api because I don’t have any internal functions exported from convex/auth.ts.

How is internal.auth supposed to be defined / generated? Is there an example of what should go in convex/auth.ts so that internal.auth exists.
Run transactional callbacks when auth data changes
Was this page helpful?