#debugging auth
90 messages · Page 1 of 1 (latest)
You are passing an empty string to your mutation when a storage ID is expected. I would advice to make audioStorageId optional or nullable if it's not always needed in your mutation.
I have made it optional and the error persisted
can you share the left side of the screen when you get the error? It sounds like you're still passing an empty string when you should avoid passing the argument entirely
This is the app's endpoint
The crux of this problem is authentication . I have also followed the docs and tried all possibilities but nothing seems to work yet. So that string will continue to be empty until I have been able to get the webhook running and there has been an handshake between clerk and convex
So the user is now auth'd successfully in clerk but as long as the convex DB is not connected to clerk then there is no user recognised in convex.
So, my question: Is there any other way to connect Convex with Clerk outside the available docs because I have followed those to the letter? Thanks
convex ENV
I hope I have provided more contex
I have not used Clerk, can you see some error message for why a webhook fails in clerk? You can also check the log page in Convex and see if there's any error from the Clerk webhook.
I mean what is to the left of the error message. I imagine it's something like
{
audioStorageId: "",
}
But i think it should be
{
}
It's a common error in my community so I belive it is something between clerk and convex that needs sorting
Here you go
thanks. The error should go away or change if you remove the 3rd line which is audioStorageId: ""
But like I said, this will be empty until the convex and clerk are on the same page wrt authentication. ''create podcast '' is a protected route
Can you show the source code for the webhook, especially the call-site that calls createPodcast
I'm focusing on the createPodcast error since that was your first question, but maybe we should focus on the webhook failures (which i can see in the clerk screenshot). As @serene rain described, do you see the webhook attempts in convex logs?
convex logs
as for the 'create podcast error' it will fix itself once we get convex and clerk hooked
I don't see any webhook calls in there. Can you filter logs to the webhook calls or reissue the webhook requests from the clerk ui?
I would also be curious to see if clerk has more information about the failures. Knowing if it's a 404 vs 500 status code would be useful
There can't be a webhook error in convex because no 'web was hooked' hence the available errors .
Clerk error is 404
Can you check the url and the http.ts / http.js file? I would also try curling the endpoint directly to see if it's a 404
cool. Scroll down a little?
That looks suspiciously like the path "/clerk" which is not the path clerk is hitting
now does it work?
did you re-issue the webhook requests from clerk after fixing the path?
yes
the next thing to check is the url. where did you get the url that clerk is hitting?
here
cool that looks right. next things to try:
make sure npx convex dev is running
curl the endpoint directly and see if you get a 404
change cloud to site . It is running and it returns 404 directly
thanks for checking. can you verify in #verify so i can take a look at the deployment on our side
done
curl is returning the error message No matching routes found which indicates to me that either npx convex dev isn't running or the file wasn't saved after /clerk was changed to /clerk-users-webhook
I'm on auto-safe and npx convex dev is running
cool while i keep looking i recommend you skim https://docs.convex.dev/functions/http-actions#debugging
I already spent days here
aha it is working. i just forgot how to use curl
curl -X POST -i <url here>
can you describe how you re-issued the clerk webhooks?
I removed the existing one and made a new one
and then did you log in again to create new users?
i don't think clerk re-issues webhook requests when you make a new webhook
you can try the "replay missing messages" button
remember the secrets change so you have to update that
yep personally i wouldn't delete and recreate the webhook; i would use the existing webhook and click "recover failed messages" and "replay missing messages"
More like clearing the cache ...when troubleshooting, I like to exhaust all available avenues.
Front end check, clerk, perfect, DB meh
This is going to just replay messages which makes no difference as long as the ''web isn't hooking" but I tried it though
user not found
are you getting a response from curl like i did?
you should see error messages in the convex logs now. i've been hitting your endpoint and receiving Uncaught WebhookVerificationError: Missing required headers
Request ID: 0a82b1006be1a51b] Server Error: Uncaught WebhookVerificationError: Missing required header
cool so the web is hooking. do you see any successful requests from clerk?
clerk works well by itself
can you screenshot the logs page of the clerk webhook
sorry i mean the Endpoints -> Message Attempts view in clerk. so we can see the status
and if the status is "Failed" click on the attempt, scroll down, and check the response code
and the HTTP RESPONSE CODE and RESPONSE fields?
cool that's an error message (and it should also appear in convex logs), can you take it from here?
here you go
do you see the error message? it looks pretty actionable to me
I don't get
the error message indicates that event.data.first_name is null, so you should account for it being null in the argument validation of createUser
This is confusing as that is not even in my schema
the error message doesn't mention schema, it mentions ArgumentValidationError
i recommend removing the exclamation point from event.data.first_name! as it prevents typescript from telling you about this bug
Thanks there is nothing wrong with my code. The problem is between clerk and convex. I will still go back to where we started
I hope you know this is not an isolated error. It is very common in my community.
what do you mean by your community
it sounds like until this morning clerk was hitting /clerk-users-webhook while convex was listening on /clerk. once you fixed that, you started hitting an issue because your convex function expects all users to have a first name while some users in clerk have first_name: null
That's not true
okay well i'm not sure how to help. i understand it's frustrating when everything seems to be failing, but working through the issues one by one should eventually get there. the error message is describing a field that is being passed as null while argument validation requires it to be a string.
concretely, i imagine the code looks like
const createUser = internalMutation({
args: { ..., name: v.string() },
handler: async (ctx, args) => {...}
});
and if you change name: v.string() to name: v.union(v.string(), v.null()) you should get past this error
if you can link to the docs that are leading you to hit errors like this, we would appreciate it. we're always looking to improve documentation.
I would have said this first.
A teacher doesn't look to go past the error but to fix it
Thanks for saying ''I'm not sure how to help" it helps.
Locking this post, as things feel as they're getting less constructive. sorry we weren't able to be more helpful. Please escalate this to a pro support ticket if you require more attention from our team.