Hi, I'm trying to use the reactjs SDK but when I'm...
# support-questions-legacy
b
Hi, I'm trying to use the reactjs SDK but when I'm calling
ThirdPartyPasswordless.createPasswordlessCode({ email })
I'm getting
error:  TypeError: Cannot read properties of undefined (reading 'createCode')
any ideas of what I am doing wrong ?
r
hey @nkshah2 can help here
n
Hi, Can I see the code for
SuperTokens.init
on the frontend?
Also can you post the full stacktrace for the error
b
Copy code
javascript 
if (typeof window !== "undefined") {
      SuperTokensReact.init(frontendConfig());
}
Copy code
javascript
export const frontendConfig = () => {
  return {
    appInfo,
    recipeList: [
      ThirdPartyPasswordless.init({
        useShadowDom: false,
        contactMethod: "EMAIL",
        getRedirectionURL: async (context) => {
          if (context.action === "SIGN_IN_AND_UP") {
            return "/authentication";
          }
        },
        signInUpFeature: {
          disableDefaultUI: true,
          providers: [Google.init(), Facebook.init(), Apple.init()]
        },
        palette: {
          primary: "#000"
        },
      }),
      SessionReact.init()
    ]
  };
};
Copy code
TypeError: Cannot read properties of undefined (reading 'createCode')
    at Object.eval (utils.js?eab2:392:1)
    at step (utils.js?eab2:190:1)
    at Object.eval [as next] (utils.js?eab2:127:1)
    at eval (utils.js?eab2:98:1)
    at new Promise (<anonymous>)
    at __awaiter (utils.js?eab2:80:1)
    at Object.createCode (utils.js?eab2:390:1)
    at Function.eval (index.js?99da:512:1)
    at step (index.js?99da:176:1)
    at Object.eval [as next] (index.js?99da:113:1)
    at eval (index.js?99da:84:1)
    at new Promise (<anonymous>)
    at __awaiter (index.js?99da:66:1)
    at Wrapper.createPasswordlessCode (index.js?99da:501:1)
    at _callee2$ (supertokens.ts?e9c4:50:5)
    at tryCatch (runtime.js?ecd4:45:16)
    at Generator.invoke [as _invoke] (runtime.js?ecd4:274:1)
    at prototype.<computed> [as next] (runtime.js?ecd4:97:1)
    at asyncGeneratorStep (asyncToGenerator.js?7eb1:3:1)
    at _next (asyncToGenerator.js?7eb1:25:1)
    at eval (asyncToGenerator.js?7eb1:32:1)
    at new Promise (<anonymous>)
    at Object.eval (asyncToGenerator.js?7eb1:21:1)
    at Object.passwordLessStart (supertokens.ts?e9c4:44:20)
    at _callee$ (AuthenticationLogin.tsx?edf7:88:33)
    at tryCatch (runtime.js?ecd4:45:16)
    at Generator.invoke [as _invoke] (runtime.js?ecd4:274:1)
    at prototype.<computed> [as next] (runtime.js?ecd4:97:1)
    at asyncGeneratorStep (asyncToGenerator.js?7eb1:3:1)
    at _next (asyncToGenerator.js?7eb1:25:1)
    at eval (asyncToGenerator.js?7eb1:32:1)
    at new Promise (<anonymous>)
    at eval (asyncToGenerator.js?7eb1:21:1)
    at eval (AuthenticationLogin.tsx?edf7:85:31)
    at eval (index.esm.js?b394:1239:1)
n
Can you try deleting
node_modules
and
package-lock.json
and reinstalling
supertokens-auth-react
?
b
I got
"supertokens-auth-react": "^0.24.1"
But still the same error
n
Hmm can you check if
supertokens-web-js
got installed in
node_modules
as well?
b
It is
"version": "0.1.4",
n
Would you mind getting on a quick call to debug this?
Or if you dont mind sharing your project code, I could take a look at it
b
We can have a call for sure, its 12:30 in France actually, I am available from 13:30, so in an hour
n
Sounds good, DM me when youre ready and Ill send you a link
In the meantime can you tell me what stack you are using? Ill try it out
b
NextJS ReactJS
n
@binouse I could recreate the problem, can you open an issue about this in the
supertokens-auth-react
SDK?
b
Okay will do. We don't have to do that call then or maybe after a workaround/fix
n
Yep we dont need to have that call, we are already working on the fix
Ill let you know here once its out
b
Perfect. thank you so much
r
hey @binouse we have released a new version of the supertokens-web-js SDK (which is a depedency of the auth-react SDK) that fixes this issue. Please remove package-lock, node_modules and reinstall.
b
Hey, coming back to this, should I replace all my supertokens-auth-react import to supertokens-web-js ? Like those in my frontentConfig, init ...
r
Hey! Not really. Just need to remove node modules and package-lock and re download
The auth-react SDK depends on the web-js SDK. And the issue mentioned above was in the web-js SDK.
b
Alright, perfect then 🙏
I still have the same issue, can you tell me the version of supertokens-web-js I should have installed ?
r
0.1.5
6 Views