Next.js Discord

Discord Forum

cannot read undefined session.status

Answered
Hoopoe posted this in #help-forum
Open in Discord
Avatar
HoopoeOP
Code:
const session = useSession({
    required: true,
  });
  if (!data || session?.status !== "authenticated") return <>Loading...</>;
  return (....)
Answered by Hoopoe
welp, i found out that the issue was i didn't use SessionProvider
View full answer

17 Replies

Avatar
HoopoeOP
this is in next build
Avatar
HoopoeOP
anyone
Avatar
Hook-billed Kite
need a larger code sample
Avatar
HoopoeOP
welp, i found out that the issue was i didn't use SessionProvider
Answer
Avatar
Hook-billed Kite
check that repo out it has a bunch of helpful stuff to reference when setting up auth
i used that recetnly
Avatar
HoopoeOP
im at v4
not v5
Avatar
Hook-billed Kite
ohh okay gotcha
Avatar
HoopoeOP
i dont want to upgrade to a beta version rn though
Avatar
Hook-billed Kite
i dont blame u
Avatar
HoopoeOP
is it stable enough?
Avatar
Hook-billed Kite
i guess we;ll find out 😂
i havent deployed yet im still developing my app
Avatar
HoopoeOP
oh cool
Avatar
Hook-billed Kite
it was just kinda hard to figure out role based auth cuz its kinda sparse