https://supertokens.com/ logo
Title
n

Noodles

10/25/2022, 9:04 PM
Is it viable to run supertokens.init on every API route? (on Next.js) or where is a better place to initialise it? I have the init inside my /api/auth route, but sometimes I get the
unhandledRejection: Error: Initialisation not done. Did you forget to call the SuperTokens.init function?
error, and I have to log out and log back in for it to go away. Any ideas?
r

rp

10/26/2022, 4:40 AM
Hey.
Yes. You need to call supertokens.init on every api route. Cause these run as serverless functions.
n

Noodles

10/26/2022, 7:53 AM
Sweet, also while we're here, does an API endpoint exist for users to change their own email address?
r

rp

10/26/2022, 7:53 AM
no. You will have to make that at the moment
n

Noodles

10/26/2022, 8:53 AM
Gotcha. I know I can change the email on my side, but there's no way to change the email that's on the core's database is there?
r

rp

10/26/2022, 8:56 AM
There is. The backend SDK has a function to update a user’s email
n

Noodles

10/26/2022, 9:09 AM
Ah, found it. Thank you for that! :)