https://supertokens.com/ logo
reading undefined
d

dionis

03/09/2023, 5:02 PM
Hi, does any one know why I'm getting this error when I add to the config file EmailPassword.init():
api/node_modules/supertokens-node/lib/build/recipe/emailverification/index.js:169
Wrapper.init = recipe_1.default.init;
                                ^
TypeError: Cannot read properties of undefined (reading 'init')
Thanks
r

rp

03/09/2023, 5:04 PM
hey @dionis whats the import statement look like in your code and how are you calling the init function?
d

dionis

03/09/2023, 5:04 PM
import { EnviormentMode, Mode, SuperTokensConfig } from '../config';
import supertokens from 'supertokens-node';
import { middleware as supertokensMiddleware, errorHandler as supertokensErrorHandler } from 'supertokens-node/lib/build/framework/express';

supertokens.init(SuperTokensConfig);
r

rp

03/09/2023, 5:05 PM
you shouldn't import from the /lib/build folder
and what about the imports in
../config
file?
d

dionis

03/09/2023, 5:08 PM
ok, I'll will change that
import EmailPassword from "supertokens-node/recipe/emailpassword";
import Session from "supertokens-node/recipe/session";
import { TypeInput } from "supertokens-node/types";
import Dashboard from "supertokens-node/recipe/dashboard";
r

rp

03/09/2023, 5:08 PM
are you using emailverification anywhere?
d

dionis

03/09/2023, 5:10 PM
no xd
r

rp

03/09/2023, 5:10 PM
can i see the full error stack?
d

dionis

03/09/2023, 5:11 PM
yes
[nodemon] starting `ts-node --files src/index.ts`
/Users/daviddionissoler/Documents/TemplateNodeNextReactTS/api/node_modules/supertokens-node/lib/build/recipe/emailverification/index.js:169
Wrapper.init = recipe_1.default.init;
                                ^
TypeError: Cannot read properties of undefined (reading 'init')
    at Object.<anonymous> (/Users/daviddionissoler/Documents/TemplateNodeNextReactTS/api/node_modules/supertokens-node/lib/build/recipe/emailverification/index.js:169:33)
    at Module._compile (node:internal/modules/cjs/loader:1191:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1245:10)
    at Object.require.extensions.<computed> [as .js] (/Users/daviddionissoler/Documents/TemplateNodeNextReactTS/api/node_modules/ts-node/src/index.ts:1608:43)
    at Module.load (node:internal/modules/cjs/loader:1069:32)
    at Function.Module._load (node:internal/modules/cjs/loader:904:12)
    at Module.require (node:internal/modules/cjs/loader:1093:19)
    at require (node:internal/modules/cjs/helpers:108:18)
    at Object.<anonymous> (/Users/daviddionissoler/Documents/TemplateNodeNextReactTS/api/node_modules/supertokens-node/lib/build/recipe/dashboard/api/userdetails/userEmailVerifyGet.js:42:45)
    at Module._compile (node:internal/modules/cjs/loader:1191:14)
[nodemon] app crashed - waiting for file changes before starting...
r

rp

03/09/2023, 5:15 PM
what version of node, npm and ts-node are you using?
d

dionis

03/09/2023, 5:17 PM
"@types/node": "^16.11.38", "ts-node": "^10.9.1", "typescript": "^4.9.5"
versions are the same as example or at least same version (not subversion)
r

rp

03/09/2023, 5:18 PM
hmm. im not sure what exactly is wrong here. Could you please open an issue about this on our github and we can have a look.
d

dionis

03/09/2023, 5:18 PM
im using receipe=emailpassword
yes
r

rp

03/09/2023, 5:18 PM
thank you
n

nkshah2

03/13/2023, 6:26 AM
Hi @dionis , What version of node were you using?
PS: I mean the exact version of node on your CLI, and not the types
m

markmanx

03/13/2023, 11:27 PM
Hey @nkshah2 I'm getting a similar error message on node
16.13.0
.
[nodemon] starting `ts-node -r dotenv-expand/config server.ts dotenv_config_path=../../.env.dev`
/Users/markm/project/node_modules/.pnpm/supertokens-node@13.1.3/node_modules/supertokens-node/lib/build/recipe/emailpassword/index.js:111
Wrapper.init = recipe_1.default.init;
                                ^
TypeError: Cannot read properties of undefined (reading 'init')
    at Object.<anonymous> (/Users/markmankarious/Projects/isoflow-v2/node_modules/.pnpm/supertokens-node@13.1.3/node_modules/supertokens-node/lib/build/recipe/emailpassword/index.js:111:33)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Object.require.extensions.<computed> [as .js] (/Users/markmankarious/Projects/isoflow-v2/node_modules/.pnpm/ts-node@10.9.1_jq3ovzqw3j7j4aj2v37zonaj5u/node_modules/ts-node/src/index.ts:1608:43)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/Users/markmankarious/Projects/isoflow-v2/node_modules/.pnpm/supertokens-node@13.1.3/node_modules/supertokens-node/lib/build/recipe/dashboard/utils.js:60:41)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
This is when trying to use:
import ThirdPartyEmailPassword from "supertokens-node/recipe/thirdpartyemailpassword";
n

nkshah2

03/14/2023, 5:56 AM
Hey can you try using npm instead of pnpm and check if that works?
m

markmanx

03/14/2023, 8:56 PM
@nkshah2 Same with
npm
. I did notice this is an issue in anything above v13 of
supertokens-node
. v12 works ok
@nkshah2 I've set up a brand new project using
npm
and installed
supertokens-node
as a package (no typescript, completely minimal test). Same error:
/Users/markmankarious/Projects/supertokens-test/node_modules/supertokens-node/lib/build/recipe/emailpassword/index.js:111
Wrapper.init = recipe_1.default.init;
                                ^

TypeError: Cannot read properties of undefined (reading 'init')
    at Object.<anonymous> (/Users/markmankarious/Projects/supertokens-test/node_modules/supertokens-node/lib/build/recipe/emailpassword/index.js:111:33)
    at Module._compile (node:internal/modules/cjs/loader:1275:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
    at Module.load (node:internal/modules/cjs/loader:1133:32)
    at Module._load (node:internal/modules/cjs/loader:972:12)
    at Module.require (node:internal/modules/cjs/loader:1157:19)
    at require (node:internal/modules/helpers:119:18)
    at Object.<anonymous> (/Users/markmankarious/Projects/supertokens-test/node_modules/supertokens-node/lib/build/recipe/dashboard/utils.js:60:41)
    at Module._compile (node:internal/modules/cjs/loader:1275:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
n

nkshah2

03/15/2023, 5:21 AM
Thanks for the issue, ill take a look at it today
m

markmanx

03/15/2023, 11:21 PM
Thanks @nkshah2
n

nkshah2

03/16/2023, 9:38 AM
Hi @markmanx, We've released a fix for this in supertokens-node version 13.1.4. We closed this issue (https://github.com/supertokens/supertokens-node/issues/513) but feel free to re-open it if the issue persists
Hi @dionis please verify that this fixes the issue for you too ^