Open mavishak opened 3 years ago
Problem The average time to send the emails out is 4 minutes (one lucky time it took 1 minute).
Problem solved We sent out a question in stackoverflow https://stackoverflow.com/questions/68146035/how-to-reduce-email-sending-time-using-nodemailer-and-firebase
We succeeded to send email's running our script locally. But we had problems running them remotely:
This is the error message we got in the firebase log:
Steps we took:
In index.js:
Allowing less secure apps into the SENDER_EMAIL account. https://myaccount.google.com/lesssecureapps
Allowing access to the SENDER_EMAIL account. Set SENDER_EMAIL to your default account. https://accounts.google.com/b/0/DisplayUnlockCaptcha
This link helped: Nodemailer with Gmail and NodeJS
Problem: It seems that access to SENDER_EMAIL account is not permanent. I didn't find what triggers it - It might be a timeout or that I mistakingly issued an access removal somehow.
Possible solution Nodemailer addresses this issue and recommends using a different provider. see:
One other thing It might be better to trigger a .onCreate event rather than .onWrite - in order to minimize the function calls and the threatening caust