Hi, I'm using SuperTokens to create a web application with passwordless autentication. I want to protect routes from users that are not autenticated, but when I use the SessionAuth wrapper it gives me "No instance of Session found" error. I checked if my app is using client side only rendering and I'm sure to have init function on the global scope. To be sure, I use one of SuperTokens pre built app, but when I import SessionAuth wrapper and I use it in my code, it gives me the same error:
"No instance of Session found. Make sure to call the Session.init method. See
https://supertokens.io/docs/emailpassword/quick-setup/frontend
at Session.getInstanceOrThrow (
http://localhost:3000/static/js/bundle.js:50352:13)
at
http://localhost:3000/static/js/bundle.js:49063:40
at commitHookEffectListMount (
http://localhost:3000/static/js/bundle.js:31962:30)
at commitPassiveMountOnFiber (
http://localhost:3000/static/js/bundle.js:33455:17)
at commitPassiveMountEffects_complete (
http://localhost:3000/static/js/bundle.js:33427:13)
at commitPassiveMountEffects_begin (
http://localhost:3000/static/js/bundle.js:33417:11)
at commitPassiveMountEffects (
http://localhost:3000/static/js/bundle.js:33407:7)
at flushPassiveEffectsImpl (
http://localhost:3000/static/js/bundle.js:35292:7)
at flushPassiveEffects (
http://localhost:3000/static/js/bundle.js:35244:18)
at commitRootImpl (
http://localhost:3000/static/js/bundle.js:35203:9)"
I'm calling the init function in an App.tsx file and then rendering App.tsx in a file index.tsx like the pre build app.
This is my SuperTokens.init() function:
SuperTokens.init(
{
appInfo: {
apiDomain: "http://localhost:8000",
apiBasePath: "/",
appName: "My App",
},
recipeList: [
EmailVerification.init(),
Session.init(),
Passwordless.init(),
],
}
)
Where can the error be?