https://supertokens.com/ logo
t

TELYA

04/13/2022, 11:56 AM
Hey, i got a little problem after enabling email verification at EmailPassword recipe.
Copy code
javascript
EmailPassword.init({
  emailVerificationFeature: {
    mode: "REQUIRED"
   }
})
I noticed this every time when i signup successfully i received two email verification email instead of one. I started to digging why this is happened and i added the createAndSendCustomEmail option to my backend setup
Copy code
typescript
EmailPasswordNode.init({
  emailVerificationFeature: {
    createAndSendCustomEmail: async (user, emailVerificationURLWithToken) => {
      console.log(user, emailVerificationURLWithToken);
    }
  }
})
The callback fired 2 times after every successful signup. I assume the root of the problem is with my frontend setup because it is the only one who is calling my backend. Do you have guys any idea what i did wrong ? 😅
n

nkshah2

04/13/2022, 11:59 AM
Hi, can you follow this troubleshooting guide and post the output: https://supertokens.com/docs/emailpassword/troubleshooting/how-to-troubleshoot
t

TELYA

04/13/2022, 12:02 PM
This is a good idea, thanks 🙂
This is the log that supertokens generated. I mean except the last two object console logs.
n

nkshah2

04/13/2022, 1:12 PM
Thanks, looks like your backend server is getting two requests during the email verification process (like you suspected). Can you post the code for when you call SuperTokens.init on the frontend? Include the full config object stripping away any API keys you may have used
t

TELYA

04/13/2022, 1:18 PM
This is the frontend config called from _app.tsx (Next.js). I didn't include the translation part.
n

nkshah2

04/13/2022, 1:23 PM
And you are using the default UI that the SDK provides correct? Just to confirm
t

TELYA

04/13/2022, 1:24 PM
Yes. By the way i can show it.
n

nkshah2

04/13/2022, 1:26 PM
Hmm we will have to look into this, in the meantime can you open an issue for this on
supertokens-auth-react
?
t

TELYA

04/13/2022, 1:27 PM
Yes, i try it 🙂
Should i include this discord thread link to the issue description ?
n

nkshah2

04/13/2022, 1:31 PM
No thats alright, a description of the issue and some sample code would be plenty
t

TELYA

04/13/2022, 1:31 PM
Okay
n

nkshah2

04/13/2022, 1:32 PM
You can include the logs you sent as well
@TELYA Are you running with
reactStrictMode: true
and in development mode?
t

TELYA

04/13/2022, 2:31 PM
Yes
n

nkshah2

04/13/2022, 2:44 PM
When you create the issue, can you also mention if using reactStrictMode false has any effect?
t

TELYA

04/13/2022, 2:59 PM
I am about to finish it very soon. Yes i will include it.
Holy moly. After i changed reactStrictMode to false i got only one callback log 😄
n

nkshah2

04/13/2022, 4:12 PM
Ah, well that should still be solved so please open that issue when you can