LifeIsBoring
LifeIsBoring4mo ago

Cannot get current user

I try to retrieve the data from current User to start to create a post, but I cannot retrieve the data somehow. I did the authentication with Clerk but did copy the data to Convex database, somehow it still cannot see the currentUser.
No description
7 Replies
LifeIsBoring
LifeIsBoringOP4mo ago
My getUserIdentity somehow doesn't work, it returns null for this
rgz
rgz4mo ago
What’s your getCurrentUser look like?
LifeIsBoring
LifeIsBoringOP4mo ago
It is in the picture on the right side
sshader
sshader4mo ago
This is usually because you're calling a query outside of a Authenticated component so it is running before the authentication has been completely propagated (https://docs.convex.dev/auth/debug#ctxauthgetuseridentity-returns-null-in-a-query) The interesting part here would be to see where you're calling the function that is unexpectedly returning null in your client code + the React tree above that
Debugging Authentication | Convex Developer Hub
You have followed one of our authentication guides but something is not working.
LifeIsBoring
LifeIsBoringOP4mo ago
Is it correct when I wrap the ConvexProviderWithClerk around with Clerk Provider ?
No description
LifeIsBoring
LifeIsBoringOP4mo ago
I am able to fix it . Thanks
Lucas Couto
Lucas Couto2mo ago
Wanted to say a big thank you for sharing this. I just spent almost 2 hours trying to understand why getUserIdentity was returning null and this worked like a charm!

Did you find this page helpful?