GetUserIdentity null
Hi there, I have a list of queries that run for it's corresponding page in my nextjs 14 web app. Inside each query I have a getUser hook that will check the identity and return the user associated with it:
However there are instances where the identity is sometimes null, therefore throwing that error and interrupting the user. How can I implement this in a better way? I feel like I'm doing something wrong here... Thank you!
3 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!
How did you implement auth? You probably want to avoid making the queries until you've sent in the auth token. Once an auth token has been sent in the auth.getUserIdentity() will not be null.
I'm using convex and clerk. The whole app is wrapped inside a convexclerkprovider
Layout.tsx
And the provider: