Having some issues with getting user response ConvexAuth
I'm running into an issue where the user session is working correctly BUT the user is returning null.
Fun fact #1: If I log the client response, the user returns in full.
Func fact #2: If I refresh the page, the user retuns null again.
Pulling my hair out - Anyone have any ideas?
12 Replies
I tested the code here and it worked fully fine for me, I'm not sure what your exact problem is but you may need to wrap your root layout with server
ConvexAuthNextjsServerProvider
, it confused me too!
https://github.com/get-convex/convex-auth/tree/main/test-nextjsGitHub
convex-auth/test-nextjs at main · get-convex/convex-auth
Library for built-in auth. Contribute to get-convex/convex-auth development by creating an account on GitHub.
patiently waiting for someone to try it out with
/src
directory cause it doesn't work the same way as /app
doesAlready wrapped in ConvexAuthNextjsServerProvider 😜
I'll leave that to the convex-team to answer, was just curious to see if someone has a similar issue to mine 😜
Lol hopefully someone can figure it out. I'm pulling the last little bit of hair I have this morning.
@Sara have you tried to retrieve user data in middleware?
Not really, check the link i provided above, it might give you some leads
sorry for the trouble here. we're going to dive into this a bit and see if we can figure out what's up
Return null
appreciate the response
GitHub
GitHub - robertalv/mycrmdb: Convex + Convex Auth + NextJS
Convex + Convex Auth + NextJS. Contribute to robertalv/mycrmdb development by creating an account on GitHub.
@rgz you're trying to use auth in the root page, but the user is not logged in. The user has to log in first.
I changed
to
then i get redirected to the sign in page. Haven't tested the rest of the flow, but this is the first thing I'm seeing after trying out the repo you shared.
Lmk if that's not the issue.
Didn't even notice that. Thank you. Yes, that solved it.