Hi <@498057949541826571> User Metadata make the a...
# support-questions-legacy
a
Hi @rp_st User Metadata make the app fail. In a handler we call
Copy code
console.log('toto1')
  const session = await Session.getSession(req, res)
  const user = await EmailPassword.getUserById(session.getUserId())

  console.log('toto2')

  if (user === undefined) {
    next(new Error('INTERNAL_AUTHENTICATION_ERROR'))
    return
  }

  const { metadata } = await UserMetadata.getUserMetadata(user.id)
It fail after the second console.log and I think it's the UserMetadata that fails it. The init looks like this:
Copy code
recipeList: [
    UserRoles.init(), // RBAC
    Session.init({ cookieDomain: `.${process.env.CLUSTER_HOST ?? ''}` }), // initializes session features
    UserMetadata.init()
  ]
Also when this occurs our pods logs this:
Copy code
/app/node_modules/supertokens-node/lib/build/recipe/emailpassword/recipe.js:204
        throw new Error("Initialisation not done. Did you forget to call the SuperTokens.init function?");
              ^

Error: Initialisation not done. Did you forget to call the SuperTokens.init function?
    at Recipe.getInstanceOrThrowError (/app/node_modules/supertokens-node/lib/build/recipe/emailpassword/recipe.js:204:15)
    at Object.getUserById (/app/node_modules/supertokens-node/lib/build/recipe/emailpassword/index.js:72:33)
    at file:///app/dist/endpoints/save_shipping/post/controller.js:18:38
    at Generator.next (<anonymous>)
    at fulfilled (file:///app/dist/endpoints/save_shipping/post/controller.js:4:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
r
Hey. You need to init the emailpassword recipe in the recipe list too.
a
thanks 🙂
4 Views