K
Kinde15mo ago
Thomas

user.email not working

giving me this error: Property 'email' does not exist on type 'Promise<KindeUser | null>'.
5 Replies
onderay
onderay15mo ago
Thanks @Thomas getting the team to look into this for you
Thomas
ThomasOP15mo ago
Thanks
onderay
onderay15mo ago
@Thomas are you able to update to use this? import { getKindeServerSession } from "@kinde-oss/kinde-auth-nextjs/server"; export default async function Dashboard() { const { getUser } = getKindeServerSession(); const user = await getUser(); return ( <main> {user && ( <div> <div>{user?.email}</div> </div> )} </main> ); } The short answer is that your default function should be async and you have to await getUser()
Thomas
ThomasOP15mo ago
It worked thank you very much!
onderay
onderay15mo ago
Yay! Thats awesome the hear!

Did you find this page helpful?