https://supertokens.com/ logo
#support-questions
Title
# support-questions
i

ITEnthusiasm

07/06/2022, 2:23 PM
Just trying to understand the implementation. Regarding the
Session
imported from
"supertokens-node/recipe/session"
for the NodeJS package... the TS types say that
Session.getSession
returns
Promise<Session.SessionContainer | undefined>
. I thought that an error was thrown whenever a
session
isn't found by
getSession
. Is there ever a case where
session
is
undefined
and no error is thrown?
r

rp

07/06/2022, 3:44 PM
Hey! Yea. It’s possible if you give an option to the getSession function which allows for optional sessions
i

ITEnthusiasm

07/06/2022, 3:50 PM
Okay so it's conditional. That makes more sense. Thanks!