https://supertokens.com/ logo
c

CaptainPhoton

06/08/2022, 5:34 PM
I'm running into a weird issue where it shouts "Initialisation not done. Did you forget to call the SuperTokens.init function?" even though I have done the initialisation and I have successfully fetched user data from Supertokens prior to the error, and successfully afterwards
This has now happened for the Session.getAllSessionHandlesForUser and the ThirdPartyPasswordless.getUserById functions
dunno, maybe Sails is weird
r

rp

06/08/2022, 5:54 PM
hey!
uhmm.. Well, you have to make sure that you call the init function before you use any of our functions.
Are you using Any other recipe other than Sessions and ThirdPartyPasswordless?
c

CaptainPhoton

06/08/2022, 5:57 PM
yes, plus UserMetadata
and I do call the init immediately when the app starts
r

rp

06/08/2022, 5:57 PM
right yea. Have you don UserMetadata.init in the recipeList?
c

CaptainPhoton

06/08/2022, 5:57 PM
yes
r

rp

06/08/2022, 5:57 PM
hmm
c

CaptainPhoton

06/08/2022, 5:58 PM
It does work before the error, and after
r

rp

06/08/2022, 5:58 PM
> It does work before the error, and after
What does this mean?
c

CaptainPhoton

06/08/2022, 5:59 PM
for example the ThirdPartyPasswordless.getUserById function. It works through many calls, then when I call it from this one place it doesn't
the place it doesn't work is a Sails controller, so the only explanation I can think of is that Sails loads controllers somehow weirdly. But I init supertokens before Sails so.... 🤷‍♂️
from experience I can tell that when something behaves "weirdly" the fault is somewhere in MY code haha 😄
but I can't figure this one out
r

rp

06/08/2022, 6:03 PM
hmm. The only explanantion is that the sails controller is happning before supertokens.init
so maybe find a place to run supertokens.init that runs before the controller
(i know i am stating the obvious, but im not familiar with sails)
c

CaptainPhoton

06/08/2022, 6:07 PM
Sails is quite bad, not a fan 😄 but yeah... it should do so already