Hi, does any one know why I'm getting this error w...
# support-questions-legacy
d
Hi, does any one know why I'm getting this error when I add to the config file EmailPassword.init():
Copy code
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
hey @daviddionis whats the import statement look like in your code and how are you calling the init function?
d
Copy code
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
you shouldn't import from the /lib/build folder
and what about the imports in
../config
file?
d
ok, I'll will change that
Copy code
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
are you using emailverification anywhere?
d
no xd
r
can i see the full error stack?
d
yes
Copy code
[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
what version of node, npm and ts-node are you using?
d
"@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
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
im using receipe=emailpassword
yes
r
thank you
n
Hi @daviddionis , What version of node were you using?
PS: I mean the exact version of node on your CLI, and not the types
m
Hey @nkshah2 I'm getting a similar error message on node
16.13.0
.
Copy code
[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:
Copy code
import ThirdPartyEmailPassword from "supertokens-node/recipe/thirdpartyemailpassword";
n
Hey can you try using npm instead of pnpm and check if that works?
m
@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:
Copy code
/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
Thanks for the issue, ill take a look at it today
m
Thanks @nkshah2
n
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 @daviddionis please verify that this fixes the issue for you too ^
3 Views