Convex Triggers not firing
I'm using the new convex plugin and seem to be struggling to get triggers to fire in the authComponent.
It seems like despite an account being created, neither of these triggers look like they're firing from what I have been able to tell.
18 Replies
Looks like you need to add the authFunctions param to the createClient settings 🙂
I don't follow?
The ‘authFunctions’
wheres internal coming from?
That’s what needed to ensure the triggers work. I think there was some mismatch with types when I was trying so I missed it, but if you first add the exports, then add the auth functions it works
Convex generated api
Import { internal } from ‘./convex/generated/api’ I believe
Sorry on mobile so not positive but should be similar
Im still new to convex, how did you get foreign keys to work, for like
auth.user?That’s what the triggers are for. Essentially giving context to the auth component records
So you add a trigger for the table you want to reference basically
gotcha
I've created a new component for my app, where my prefernces live in. I'm trying to reference the better auth userid to the other component.
as a foreign key
you get any type errors with using the
internal.auth?
@Smultar
You need the exports first
Then types will work
That’s what confused me too

this one
OH i understandn ow
Local Install | Convex + Better Auth
Own your auth.
@Ryno
The other way. I haven’t tried hosting anything myself
Local install is mostly using types locally in your app component vs having a separate better with components
Not really a physical hosting location @Ryno
Yeah, I don’t do anything special. I use the generated types, but not the separate generatable schemas and such
I basically just followed the convex + better auth docs
Same here, but I'm glad you mentioned this fix for the trigger
Have you make an issue to the main repo for convex better auth?
Nope. I don’t think it is an issue. The exports need to exist for the types to be generated, so it’s working as intended, just a bit odd.