question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

firestore-send-email sets document state to PROCESSING indefinitely

See original GitHub issue

[REQUIRED] Step 2: Describe your configuration

  • Extension name: firestore-send-email
  • Extension version: v0.1.7
  • Configuration values (redact info where appropriate):
    • Cloud Functions location: us-central1
    • SMTP connection URI: smtp://<POSTMARK_API_TOKEN>:<POSTMARK_API_TOKEN>@smtp.postmarkapp.com:25
    • Email documents collection: emails
    • Default FROM address: User user@example.com
    • Default REPLY-TO address (Optional): Parameter not set
    • Users collection (Optional): users
    • Templates collection (Optional): emailTemplates

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

When adding a document to my emails collection, I am getting an indefinite state of PROCESSING.

Expected result

Expected the state to move beyond PROCESSING and send the mail.

Actual result

The document persists in the following state indefinitely.

createdAt: January 23, 2021 at 8:59:40 AM UTC-6
delivery:
  attempts: 0
  error: null
  leaseExpireTime: January 23, 2021 at 9:00:45 AM UTC-6
  startTime: January 23, 2021 at 8:59:44 AM UTC-6
  state: "PROCESSING"
from: "Ben Example <user@example.com>"
message:
  subject: "Example subject"
  text: "Example message"
private: true
replyTo: "ben.example@gmail.com"
toUids:
  0: "HkKeaL2MxJZkymy3g89OIBDDaYH3"
userId: "HkKeaL2MxJZkymy3g89OIBDDaYH3"

Details:

I am using Postmark. My smtp URI looks like smtp://<POSTMARK_API_TOKEN>:<POSTMARK_API_TOKEN>@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. The username and password for postmark are the same, the API token.

Debug:

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 the Postmark smtp URI.

I also dug into the extensions code a little bit. In the extension, 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().

https://github.com/firebase/extensions/blob/3aa9fd59fbdf384bf2e5d262483c6ece9d2d8057/firestore-send-email/functions/src/index.ts#L325-L337

However, if deliver() was called at all, why would attempts remain 0? My logs confirm that the “Attempting delivery…” message is not present either.

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 #48. Not sure if the issues there are still causing issues with this firebase extension.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
briankerrcommented, Jan 26, 2021

Hello, chiming in from Postmark’s support perspective 👋

We offer ports 25 , 2525, and 587 for outbound SMTP. This could suggest that Firebase started blocking port 25. Blocking that port is pretty common as an anti-abuse measure for a host.

I couldn’t find a blocked port list in Firebase’s docs, but I see that Google Computer Engine blocks port 25 so it wouldn’t surprise me if they started to use a similar rule here.

1reaction
bdizcommented, Jan 26, 2021

Hi @russellwheatley , with smtp and 587 it finished with SUCCESS and I received the email. Thank you.

I’ll notify Postmark support of this issue, as they believe port 25 should work.

Also, as I mentioned previously it does work on port 25 when sent via nodemailer in a node REPL. I’m wondering if there is an enhancement that could get it working in this extension, and at a minimum provide better debug messages vs timing out in the PROCESSING state.

Thank you for looking this over and providing these suggestions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hangfire job gets requeued indefinitely (or stuck in processing ...
If I check the result of the job it looks like the job is finished, but it seems like just a second before...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found