Closed aq2 closed 4 years ago
Hi @aq2 - Would you be able to check the Firebase Functions logs to see if any error is occurring?
okay thanks,
i'm just testing this with a simple button on my website that adds a document to my 'mail' collection
i press the button, see the new doc in the collection, but it stays at 'processing' - no errors shown in 'delivery' field - just says 'null' and 0 attempts
logs don't seem to give any obvious error messages, but it eventually times out
i'm not sure what you want to see...
@aq2 Hello :) I don't see an "smtpConnectionUri" on your extension's configuration. Is it normal ?
@rphlmr It's omitted as it's a sensitive field.
I'll try this out myself using my own Gmail account as the SMTP provider. My initial thinking is that node-mailer
is forever trying to connect to the SMTP server and eventually timeout the function.
@aq2 would you be able to try smtps://
rather than smtp://
? The Gmail SMTP server requires SSL by the looks of it.
@Ehesp oh yes 🤦♂️
If it can help @aq2 , I have this config (working):
smtps://me@mydomain.app:verycomplicatedpassword@my.smpt.provider:465
hi - thanks for your inputs,
I have managed to get it working using a different email provider, but am still unable to use with gmail, whether using smtp or smtps
I have heard that gmail are quite a large email company and i am surprised that i can't get the extension working with them.
@Ehesp did you manage to get gmail working?
Could you try setting the from
address as your own email used for Gmail?
sorry, not quite sure what you mean
i've been using the same email address in 'from' and smtp URI - ie my gmail address
or are you suggesting that i use gmail URI, but with a different from address - like 'send as'?
sorry - pressed the wrong button - didn't mean to close - whoops
That's ok then, I believe Gmail has restrictions around the from sender address having to be the same as the SMTP user.
Let me try and get Gmail sync'd up and I'll get back to you on whether I can get it working.
I have came across the same issue as the op. However, I tried with my gmail and it worked. (example@gmail.com). But I tried with a GSuite email (example@customdomain.com) and it did not work for that email. The delivery state is stuck on PROCESSING and the cloud function is timing out after one minute. Any suggestion is appreciated. Thanks in advance.
I am also having this issue. I've also now tried it with a Yahoo mail account and the same thing happens. My function config: (NB, I've also tried with smtps using port 587. I've tried with the normal account password and with a generated app-specific password. I'm kind of tearing my hair out here, so any help from anyone who has overcome this with any decent email provider would be extremely welcome. Thanks!
So, I don't think this is an issue with the email provider. I knocked up a quick and dirty nodemailer app and it worked perfectly with the same account details.
What Firebase plan are you on? Trying to replicate in the same environment.
Blaze
Hi @Ehesp - thanks for helping me with this. Further info - I've set up a custom function, triggered from the same collection, that uses nodeMailer to send the required emails and it works fine using my email account details that weren't working with the ready-made email trigger. I've had a look at the source of the ready-made one and nothing jumps out at me. Could it be to do with the way the smtp url string is being parsed? I notice that the collection document gets updated with attempts: 0, whatever config etc I tried and even when errors were reported.
I had the same issue - my challenge was that my email was a GSuite account and I needed to allow access from Less Secure Apps. I had to go into my GSuite account, Security allows Users to Set own Less Secure Apps. Then set it for my email.
It was a bit of a struggle but I hope that helps someone.
I couldn't do that with my initial email account as it has 2FA. However, I followed the various instructions for that, including an app-specific password and didn't have any joy. Then I set up another GMail account without 2FA and followed the allow-less-secure and recaptcha settings - still didn't work. It's the latter account that I have working fine, now, with my own cloud function. It's weird how this seems to work for some users and not for others.
I have the same problem with the GSuite account. I allowed access from Less Secure Apps but nothing. It doesn't work. I have also tried all possible combinations with port 587 and without it.
If it helps, what I did for GMAIL account:
smtps://namel@gmail.com:pass@smtp.gmail.com:465
and then a enable "Less secure app access"
https://myaccount.google.com/u/2/lesssecureapps
I didn't manage to use my GSuite account tho yet.
Thanks - and I'm glad you got it working. I've found that my custom cloud function does everything I need it to do, so I've moved on to other areas of functionality.
For all fighting with the correct connection URL, it might help to consult nodemailer documentation. https://nodemailer.com/smtp/
The extension just passes the connection URL as is to nodemailer. I stopped trying with gmail cause of 2FA. Testing can be better done with mailservices like sendgrid or mailgun. They have free plans and offer a SMTP gateway which one can use.
For all fighting with the correct connection URL, it might help to consult nodemailer documentation. https://nodemailer.com/smtp/
The extension just passes the connection URL as is to nodemailer. I stopped trying with gmail cause of 2FA. Testing can be better done with mailservices like sendgrid or mailgun. They have free plans and offer a SMTP gateway which one can use.
Isn't it the idea of the extension to handle this without extra impediments?
For those who are still struggling with GSuite emails for the Email Trigger Extension. I think I may have found a solution. As the OP says I was stuck at the PROCESSING
state and nothing happened when I gave the smtps URI as smtps://username@customGSuiteDomain.tld:veryComplicatedPassword@smtp.gmail.com:465
.
However when I used a password without any special characters it worked. NB: The following settings were set for the GSuite email account.
Less secure apps: ON
I have the same problem with the GSuite account. I allowed access from Less Secure Apps but nothing. It doesn't work. I have also tried all possible combinations with port 587 and without it.
@ctwhome pls try this and find out whether it worked for you or not.
However when I used a password without any special characters it worked.
I URL encoded the special characters in my password and that worked fine.
Have it working with 1) Less secure apps setting
2) SMTP Server
smtps://username@customGSuiteDomain.tld:veryComplicatedPassword%21%0A@smtp.gmail.com:465
NB. from email same as auth email although idk if that is necessary
@Niweera
@MatteoStohlman yeah, I did the same. It's working fine for me.
Hi guys, any update about this issue?
Had the same issue until I encoded the password - you can check it here to make sure https://www.urlencoder.org/
Hi @shaisa, I had not only encoded the password but also changed to a simple password, without special character.
I believe google functions has some problem to execute Nodemailer with a provider different than Google. When I try to send an email with my email provider anything works.
I have tried locally with Firebase Functions Emulator and in a vanilla Node.js. The code works fine in a vanilla node.js application but doesn't work with Firebase Function.
Mmmm.... You know what - I couldn't make the extension to work with my g-suite smtp-relay as well... I guess gmail is the only one working right now. And the logs are worthless to understand why.
If only someone from google was here to help ;)...
I wouldn't recommend using GMail or G Suite to send email for an application. They are designed to be personal / business email accounts, not automated mass mailers. There are a variety of providers like SendGrid, Mailgun, etc. that are designed more for the purpose and work well with the extension. That being said, I'm not opposed to figuring out what's going on here, but it's not at the top of our priority list at the moment.
On Mon, Dec 16, 2019, 5:37 AM shaisa notifications@github.com wrote:
Mmmm.... You know what - I couldn't make the extension to work with my g-suite smtp-relay as well... I guess gmail is the only one working right now. And the logs are worthless to understand why.
If only someone from google was here to help ;)...
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/firebase/extensions/issues/41?email_source=notifications&email_token=AAAAH7UPDW4HECZS6SYXOF3QY577ZA5CNFSM4JAGYQTKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEG6XJAI#issuecomment-566064257, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAAH7RGYXNYNKKAXGQXJUDQY577ZANCNFSM4JAGYQTA .
Of course - at least on my end this is not the case - this is a part of evaluating the extension in terms of usability and limitations (btw, not all use cases are for mass mailing so I wouldn't dismiss this issue because of that). When something doesn't work without understanding why - it is a sign for me that there might be more "black holes" down the road and I take it into consideration before moving it to production. Maybe it's a good idea to add a log when this error occurs in the extension or a known issue somewhere to notify people of this bug (/feature). Even a small "G Suite smtp-relay is not supported" message in the configuration GUI / CLI would do the job and save time for people trying it...
Hi! After all the services that firebase provides to create extremely fast, complex, realtime applications... Having to use a third party like sendgrid to handle emails seems odd to me. I mean, for an application sending emails to customers is fundamental, why is this not being part of the core functionalities of firebase? Maybe firebase hosting?
Hi, we are not planning to offer an email service within Firebase in the forseeable future.
It seems like the workaround in https://github.com/firebase/extensions/issues/41#issuecomment-554705606 is the best approach. Perhaps we can document this more clearly.
I don't think it's a gmail/gsuite specific issue. I am getting an indefinite PROCESSING status with Postmark. My smtp URI looks like smtp://abcdef-1234:abcdef-1234@smtp.postmarkapp.com:25
. Postmark uses an api key with only hex characters and dashes so special characters doesn't seem like it would be the issue in my case. The password and username for postmark are the same.
I tried this smtp URI with nodemailer in a node repl locally and I was able to send an email successfully so it doesn't seem to be Postmark.
I previously was using SendGrid with this extension and I had emails working.
Complicating my debug data is I upgraded the extension from node 8 to node 10, but I'm not sure that has anything to do with seeing this issue since I never tried Postmark on node 8. Nor have I tried SendGrid on node 10. Trying to reactivate my SendGrid account to see if I can get that working again (they deactivated me without notice (I'm thinking due to low volume), which is what sent me on this goose chase in the first place).
Trying to debug the function. Upon the create of the initial document the cloud function updates attempts
to 0 and state
to PENDING. But what I see when observing the document in the firebase console is attempts are 0 and state is PROCESSING.
Looking at the switch statement for PENDING, it sets state
to PROCESSING and then should call deliver()
.
However, if deliver()
was called at all, why would attempts remain 0? My logs confirm that the "Attempting delivery..." message is not present either.
These observations match with earlier reports: The original post shows attempts
0 (https://github.com/firebase/extensions/issues/41#issue-506318313). and a later comment shows a log that does not have a "Attempting delivery..." message (https://github.com/firebase/extensions/issues/41#issuecomment-541691437).
Is there something with await admin.firestore().runTransaction
where it might be hanging there (though update of state
to PROCESSING goes through)? I see there is a comment in the code about issue https://github.com/firebase/extensions/issues/48. Not sure if the issues there are still causing issues with this firebase extension.
@Ehesp can we reopen?
@Ehesp , do you want me to file a new bug? Node 10 simply won't send an email for me.
Also had this problem and removing the special characters from the password worked for me as well! Thanks 🙏🏽
I also had the same issue, trying to send with a gmail account (not G-Suite).
What worked:
The above 2 steps did the trick.
Hi - not sure if this is the right place for support, but here goes...
My emails are stuck in 'PROCESSING' mode
i'm using gmail to send my mails, using smtp://me@gmail.com:password@smtp.gmail.com:465
what am i doing wrong?
thanks in advance