isAuthenticated is always false
I started a new project by copying all contents from another project. I swapped all credentials and env variables to the new ones; the new ones from convex and clerk.
convex verbose logs show all green as well as network logs.
also did not change the jwt template name "convex"
oh and I successfully create and get the user object from clerk
for some reason isAuthenticated is always false.
for the life of me i cant figure out what's the issue.
i'm about the start the new project from scratch rather than beginning with the copy. Hoping this doesnt come to that...requesting assistance, and thank you in advance.
19 Replies
What about auth.config.js/ts
Just verifying that was updated
yep, thats updated as well
Have you logged out all associated values at build/runtime to ensure they're what you expect
Basically validating every assumption
i hear you, and thats always a good reminder/suggestion.
pretty sure i have over the course of debugging but i'll try again
yeah I'm sure you know the drill. trying to find a good reason why this would be happening otherwise, nothing yet
getUserIdentity()
is returning a user on the backend?im in the auth flow where a user signs up on the platform and
getUserIdentity()
does not get reached.
On the client, however,
import { useUser, useSession } from "@clerk/nextjs";
import { useConvexAuth, useMutation } from "convex/react";
const { isAuthenticated } = useConvexAuth(); // always false
const { session, isLoaded, isSignedIn } = useSession(); all 3 are truthy
Given that my setup works in the original project, i'm going to switch back credentials and see wat happensYeah that's a good step to try
next.js is the part I'm not super familiar with here
i think i figured it out..at least at the surface layer.
there ended up being a race condition that was happening in the application logic.
This puzzles me quite a bit because the application logic hasnt changed across projects, but works flawlessly in the original.
hmm that's weird
it is man, annoying too lol
lol always
does the race condition make sense at least or still digging
running into more weird issues on the clone
getting an error saying 400 Bad Request: TooManyIndexes on a table that has 29 indexes. 32 is the limit
completely separate convex projects between these two apps?
and for some darn reason, the same code, same number of indexes work on the OG
two separate projects with different credentials
i think i may have caused some issues when copying and pasting
Maybe try diffing the two projects
yea, i think im just going to switch to a bottom up approach and start from scratch rather than copy&paste. Wouldve loved to figure out whats happening but the product/business hat takes priority
appreciate the support man
np, sorry we couldn't get to the bottom of it
For next time:
https://docs.convex.dev/auth/debug
Debugging Authentication | Convex Developer Hub
You have followed one of our authentication guides but something is not working.
@Michal Srb Just saw this, looks like a solid guide, thank you!