Clerk With Convex in Backend Functions
I want to store a score variable in the public metadata but I can't figure out how to modify that from the backend and I get an error?
Error:
Code:
15 Replies
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
You cant make a request inside a mutation you need an action for that
are you able to provide me with any documentation? I was having trouble finding info on it
Actions | Convex Developer Hub
Actions can call third party services to do things such as processing a payment
only actions can access the internet
ah okay
Thank you 👑
🫡
@FleetAdmiralJakob 🗕 🗗 🗙 So do I have to have a httpAction api function that my other function calls?
im just a little bit confused on how to implement this
you actually dont need an httpAction just a normal action. your other functions call this action then
httpAction is when you want to call your functions from a webhook or a custom client.
ah okay
@FleetAdmiralJakob 🗕 🗗 🗙 Have you used clerk before? Are you at all expierenced with messing with it from the backend
Yeah I use Clerk + Convex and there are a few questions to be answered and problems to be solved
One question for example is where do I want to store user data. Both Clerk and Convex offer to store User data. There are three options: In Convex, in Clerk, try to sync both so it doesn't matter but Convex is faster
For myself I found that it's the easiest to only use Clerk for Auth and store user data in Convex but try to keep both in sync but the source of truth stays Convex
Other problems I had was with the signup flow. I wanted a custom username schema. Clerk doesn't offer this type of thing so I had to sent all the credentials to my server first and sign up and create the user from there for example
Ah i see
i just need something simple where each user can have stats stored about them
i think using meta data in clerk would be fine but im trying to decide
If you store it in metadata in Clerk then u need actions for everything and querying from Clerk will take longer than from Convex
Check out https://docs.convex.dev/auth/database-auth if you haven't already -- it goes over a few strategies for syncing over data from Clerk to Convex.
As y'all are mentioning, it's technically possible to make everything an action and always request the user data from Clerk, but then you lose out on many of the benefits on Convex (no realtime updates, no automatic caching)
Storing Users in the Convex Database | Convex Developer Hub
_If you're using Convex Auth the user information
@sshader @FleetAdmiralJakob 🗕 🗗 🗙 alright i see
ill look into it thank you so much!