firebase / extensions

Source code for official Firebase extensions
https://firebase.google.com/products/extensions
Apache License 2.0
886 stars 376 forks source link

Cannot read property 'sendMail' of undefined #954

Closed yamankatby closed 2 years ago

yamankatby commented 2 years ago

[REQUIRED] Step 2: Describe your configuration

Screen Shot 2022-04-28 at 07 17 40

[REQUIRED] Step 3: Describe the problem

Screen Shot 2022-04-28 at 07 21 20

Screen Shot 2022-04-28 at 07 23 46

Steps to reproduce:

Expected result

To be sent or to show any clear error message/log

danhockley commented 2 years ago

Did you find a solution to this?

yamankatby commented 2 years ago

Hi @danhockley, No, not yet. But I'll be working on fixing this soon, so please consider providing me with any information you think might be useful.

mateuszsoppo commented 2 years ago

Same situation here, did you find a solution ? @yamankatby @danhockley

nwatab commented 2 years ago

Same here. I tried password in URI (backward compat) and secure password. They didn't work at 0.1.17. Edited: Fixed by using SMTP Relay of SendGrid.

debungle-it commented 2 years ago

I have the same issue - Adding myself so that I have visibility into the status

CeccoCQ commented 2 years ago

Same issue, how I can rollback to previous version?

dackers86 commented 2 years ago

Hi @CeccoCQ

The only current way to roll back is to, find a specific commit and use the cli to update using...

firebase ext:update {ext-name} . --project={project_name}

You could as an alternative, create a new installation and use the a specified version to create a new instance.

firebase ext:install firestore-send-email@{version} --project={project_name}

CeccoCQ commented 2 years ago

Hi @dackers86 , I understand, but I've a question: can the problem be solved with a future update of the extension?

dackers86 commented 2 years ago

Yes, it is currently under investigation.

Initial tests have so far been unable to replicate, but we will most likely release a fix in the next version once it can be replicated (and solved).

CeccoCQ commented 2 years ago

@dackers86 great! Thanks

michalkubizna commented 1 year ago

This is not solved. I am still getting this message: "Cannot read property 'sendMail' of undefined".

dackers86 commented 1 year ago

HI @mateuszsoppo.

Can you confirm what version of the extension you are running? And also an example of the mail document (and template) that you are attempting to process. Thanks!

michalkubizna commented 1 year ago

I am using version 0.1.23. I made a typo by not including the '@' symbol. So instead of 'smtps://${email}@smtp.gmail.com:465', I wrote 'smtps://${email}:smtp.gmail.com:465'. But the error message wasn't very helpful.

dackers86 commented 1 year ago

Thanks @michalkubizna.

This has highlighted a bug on line https://github.com/firebase/extensions/blob/0696bfe518b318c4530700f348a4a97bd7c55942/firestore-send-email/functions/src/index.ts#L274.

We do test for valid smtp url, but will require an update to warn the user if this is invalid when sending emails.

dackers86 commented 1 year ago

Issue added : https://github.com/firebase/extensions/issues/1472

biomichael commented 4 months ago

I solved it by passing smtp credentials URI encoded. so instead of this: smtps://username@gmail.com:password@smtp.gmail.com:465 you would pass smtps://username%40gmail.com%3Apassword@smtp.gmail.com:465 Note: if you are using gmail server you might need to set up a App Password which is a string of 16 random characters in 4 groups.