Hi, when I'm calling my override functions I'm getting `Error: Initialisation not done. Did you forg...
b
Hi, when I'm calling my override functions I'm getting
Error: Initialisation not done. Did you forget to call the SuperTokens.init function?
. However I call Supertokens.init in my api/auth/[[...path]].tsx do you know why ?
r
Hey!
Hey!
Which recipe’s function are you calling when u get this error?
b
I overrode consumeCode and thidPartySignInUp
r
Right. But what function do you call when you get this error?
What’s the stack trace?
b
I'm calling consumePasswordlessCode
r
I see. Are you sure that you are calling supertokens init before that? Can you add a console log where you call init and when you call this function
And see the order of logs
b
Yep that’s the problem i logged my init and it is initialised just before the function
r
Can you show me the code?
Are you importing from the right library? And initing the right lib?
b
And to be honest i never had that problem even if I am working with supertokens since 3 weeks now
import supertokens from "supertokens-node";
import ThirdPartyPasswordlessNode from "supertokens-node/recipe/thirdpartypasswordless";
r
Hmm. And the init code itself?
And are you calling this in server side rendering?
b
supertokens.init(backendConfig());
r
does the consumeCode function get called?
i.e. your custom logic
b
Yes and the
console.log("response: ", response);
is called
So it is returning something
r
so then when does it throw the erorr?
b
I'm getting a 500 internal server error front side and the Initialisation not done in back
r
Hmmm
I’m not really sure
Are you calling this api from the frontend for sure? About not from server side rendered backend?
I suggest that you could use a debugger and step through to see what’s happening
b
Okay I'll try to better understand what’s going on and maybe reach you leater
Thank you so much for your help
r
Sounds good. If the error persists, I’m happy to jump on a call as well to debug together. Lmk
b
It can’t be linked to the supertokens-web-js dependence updqte to 0.1.5 ? Because I think that it’s the only thing that changed in my code
I'm not sure tho but it is strange that my http://localhost:3000/api/auth/signinup/code is working perfectly fine and my http://localhost:3000/api/auth/signinup/code/consume is not and that the only difference is that i override the second one
r
Hmmmm. Can you comment out the logic in your override and see if it works?
b
I got the same error 500
on consumeCode
r
Right. So it’s nothing to do with the override anymore then
Do you want to get on a quick call?
b
why not if it can be helpful 😅
r
ok sending you a zoom llink
Join Zoom Meeting https://us06web.zoom.us/j/81708149707?pwd=bHdhNXJmOEdPRWRpbXBTT0N1bXJIQT09 Meeting ID: 817 0814 9707 Passcode: 841400 One tap mobile +13863475053,,81708149707#,,,,*841400# US +15642172000,,81708149707#,,,,*841400# US Dial by your location +1 386 347 5053 US +1 564 217 2000 US +1 646 931 3860 US +1 669 444 9171 US +1 669 900 6833 US (San Jose) +1 719 359 4580 US +1 929 205 6099 US (New York) +1 253 215 8782 US (Tacoma) +1 301 715 8592 US (Washington DC) +1 309 205 3325 US +1 312 626 6799 US (Chicago) +1 346 248 7799 US (Houston) Meeting ID: 817 0814 9707 Passcode: 841400 Find your local number: https://us06web.zoom.us/u/kVdTd4iZM
b
Okay I'm getting the error again, but in the catch this time
Copy code
Error: Initialisation not done. Did you forget to call the SuperTokens.init function?
    at Function.getInstanceOrThrowError (/Users/aircampus15/aircampus/node_modules/supertokens-node/lib/build/recipe/session/recipe.js:217:15)
    at Function.createNewSession (/Users/aircampus15/aircampus/node_modules/supertokens-node/lib/build/recipe/session/index.js:27:33)
    at Object.<anonymous> (/Users/aircampus15/aircampus/node_modules/supertokens-node/lib/build/recipe/passwordless/api/implementation.js:58:57)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/aircampus15/aircampus/node_modules/supertokens-node/lib/build/recipe/passwordless/api/implementation.js:15:36)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
I'll try to implement it in a new repository to be able to share it with you
r
Oh I see. Do you do session.init in the recipeList?
For the backend config?
Right yea. That’s the problem
Session.init needs to be done. If you see the NextJS guide in our docs, it says you need to do tag
That*
@binouse
b
Oh gosh I am so dumb ! I tried an override of a Session function and removed it but also removed the Session.init !
I hate myself right now
So sorry
r
Hehe no worries. Happens to the best of us 🙂
Glad we could point out the error
516 Views