Next.js Discord

Discord Forum

cannot read undefined session.status

Answered
Hoopoe posted this in #help-forum
Open in Discord
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

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