hi all! i have the following code,
"use client"
import { api } from "@/convex/_generated/api"
import { useConvexAuth, useQuery } from "convex/react"
import { Skeleton } from "@/components/ui/skeleton"
export function SideBar() {
const { isLoading } = useConvexAuth()
const username = useQuery(
api.db.username,
isLoading ? "skip" : {}
)
return <span className="capitalize">{username}</span>
}
and i've been running into the following error when i click on "logout"
ConvexError: [CONVEX Q(db:username)] [Request ID: 26f4c2ab052920a5] Server Error
Uncaught ConvexError: Unauthenticated call to function requiring authentication
at getClerkIdentity (../../convex/db/user.ts:18:6)
at async handler (../../convex/db/user.ts:166:17)
Called by client
is it possible to move api.db.username to the server side for this component? or am i taking a wrong path? thanks!