zid
zid8mo ago

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
erquhart
erquhart8mo ago
What about auth.config.js/ts Just verifying that was updated
zid
zidOP8mo ago
yep, thats updated as well
erquhart
erquhart8mo ago
Have you logged out all associated values at build/runtime to ensure they're what you expect Basically validating every assumption
zid
zidOP8mo ago
i hear you, and thats always a good reminder/suggestion. pretty sure i have over the course of debugging but i'll try again
erquhart
erquhart8mo ago
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?
zid
zidOP8mo ago
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 happens
erquhart
erquhart8mo ago
Yeah that's a good step to try next.js is the part I'm not super familiar with here
zid
zidOP8mo ago
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.
erquhart
erquhart8mo ago
hmm that's weird
zid
zidOP8mo ago
it is man, annoying too lol
erquhart
erquhart8mo ago
lol always does the race condition make sense at least or still digging
zid
zidOP8mo ago
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
erquhart
erquhart8mo ago
completely separate convex projects between these two apps?
zid
zidOP8mo ago
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
erquhart
erquhart8mo ago
Maybe try diffing the two projects
zid
zidOP8mo ago
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
erquhart
erquhart8mo ago
np, sorry we couldn't get to the bottom of it
Michal Srb
Michal Srb8mo ago
Debugging Authentication | Convex Developer Hub
You have followed one of our authentication guides but something is not working.
zid
zidOP8mo ago
@Michal Srb Just saw this, looks like a solid guide, thank you!

Did you find this page helpful?