I am trying to send confirmation mail after signing up with email password with firebase and next.js . I am new to both next.js & firebase so I’m having some difficulties.
The problem is, I am getting a confirmation mail in my email but before I confirm and redirect to the page , it’s automatically redirecting to the homepage. So ultimately there is no point of mail confirmation.
I think somehow the emailVerified is always true which I need to stop.
I have tried with this block of code but not working.
const res = await createUserWithEmailAndPassword(auth, email, password);
if (res.user) {
firebaseAdmin.auth().updateUser(res.user.uid, { emailVerified: false });
sendEmailVerification(res.user);
router.push('/');
}
This is the error I am getting:
./node_modules/@google-cloud/storage/build/src/bucket.js:22:0
Module not found: Can't resolve 'fs'
When I remove firebaseAdmin.auth().updateUser(res.user.uid, { emailVerified: false }); this line, then the error is solved but then I am not getting any confirmation mail.
Can anyone please help with this?
>Solution :
To resolve the Module not found: Can't resolve 'fs' error, install the fs package using this command
yarn add fs
or
npm install fs --save