xTazy
xTazy6d ago

Better-auth triggers are never called

export const authComponent = createClient<DataModel>(components.betterAuth, { verbose: true, triggers: { user: { onCreate: async (ctx, doc) => { console.log('Creating user for authId:', doc._id); await ctx.db.insert("user", { authId: doc._id, email: doc.email, profileImage: doc.image, ...({} as any), }); }, onDelete: async (ctx, doc) => { console.log('Deleting user for authId:', doc._id); const user = await ctx.db .query("user") .withIndex("by_auth_id", (q) => q.eq("authId", doc._id)) .first(); await ctx.db.patch(user!._id, { deletionAt: Date.now() }); }, }, }, }); export const { onCreate, onDelete } = authComponent.triggersApi();
1 Reply
xTazy
xTazyOP6d ago
migrating to better-auth: 1.3.34 and convex ba: 0.9.7 solved the problem

Did you find this page helpful?