Eva
Eva4w ago

Dashboard function tester question

Is there a way I can create a user in my app from the Convex dashboard? I'm using Convex auth and I've set up createOrUpdateUser in auth.ts but it's not available within the function explorer.
4 Replies
ari
ari4w ago
Is createOrUpdateUser a mutation? If so, does it appear in the functions page? All queries, mutations, and actions should show up in the dashboard function tester so if it’s not we’ll need to investigate
Eva
EvaOP4w ago
It's not defined as a mutation the same way that other mutations are. This is the format I followed from Convex Auth:
export const createOrUpdateUser = async (ctx: MutationCtx, args: any) => {

...

}

export const { auth, signIn, signOut, store } = convexAuth({
providers: [ ... ],

callbacks: {
createOrUpdateUser,
},
});
export const createOrUpdateUser = async (ctx: MutationCtx, args: any) => {

...

}

export const { auth, signIn, signOut, store } = convexAuth({
providers: [ ... ],

callbacks: {
createOrUpdateUser,
},
});
ari
ari4w ago
Ah, I see, I'm not too familiar with convex auth but it looks like createOrUpdateUser ends up getting called by some other function defined by convex auth. I followed the chain and it looks like it's this function: https://github.com/get-convex/convex-auth/blob/main/src/server/implementation/index.ts#L449 Given the level of abstraction in convex-auth, i'd recommend following ian's suggestion outside the thread
Eva
EvaOP4w ago
Thank you!

Did you find this page helpful?