extensions icon indicating copy to clipboard operation
extensions copied to clipboard

🐛 [firestore-send-email] Delivery fails consistently with "Expected array, received object" (SMTP/Mandrill)

Open danielsigl opened this issue 2 months ago • 15 comments

[READ] Step 1: Are you in the right place?

Issues filed here should be about bugs for a specific extension in this repository. If you have a general question, need help debugging, or fall into some other category use one of these other channels:

  • For general technical questions, post a question on StackOverflow   with the firebase tag.
  • For general Firebase discussion, use the firebase-talk   google group.
  • To file a bug against the Firebase Extensions platform, or for an issue affecting multiple extensions, please reach out to   Firebase support directly.

[REQUIRED] Step 2: Describe your configuration

  • Extension name: firestore-send-email
  • Extension version: 0.2.4
  • Configuration values (redact info where appropriate):   - Email Provider: SMTP / Mandrill (smtp.mandrillapp.com was used)   - Mails collection: mails   - SMTP Credentials: [REDACTED]

[REQUIRED] Step 3: Describe the problem

The extension fails to send emails when using SMTP/Mandrill as a provider.

The core error is a type mismatch: the extension sends a single message object to the underlying mail transport layer, but a dependency update (likely bundled with the extension update) has caused the transport layer to now expect an Array at the payload root.

Failure Consistency: The error has occurred consistently every Monday since the update to version 0.2.4 during the automated sending of reports, specifically 43 times each week. Reports without the specific required data are successfully skipped. More than 300 mails with the same data structure/object are successfully sent within this run.

Image

Steps to reproduce:

  1. Install an affected version of the firestore-send-email extension (e.g., 0.2.4).
  2. Configure it to use SMTP with Mandrill credentials.
  3. Add a valid email document to the configured mails collection.
  4. The extension function is triggered but fails to deliver the email.
  5. The Cloud Function-Logs show the following error:

Error: Error when delivering message=mails/GoQQ8YqXGjx9RtRG1H4w: [ { "code": "invalid_type", "expected": "array", "received": "object", "path": [], "message": "Expected array, received object" } ] at .entryFromArgs ( /workspace/node_modules/firebase-functions/lib/logger/index.js:133 ) at .Object.error ( /workspace/node_modules/firebase-functions/lib/logger/index.js:120 ) at .Object.deliveryError ( /workspace/lib/logs.js:66 ) at .deliver ( /workspace/lib/index.js:165 ) at process.processTicksAndRejections ( node:internal/process/task_queues:105 )

The key failure point is in the extension's own code at .deliver ( /workspace/lib/index.js:165 ), which is attempting the API call.

Expected result

The extension should successfully send the email via the Mandrill SMTP service. The internal extension code should be adapted to wrap the message object in an array before passing it to the transport layer.

Actual result

The email delivery fails with the validation error: Expected array, received object.

danielsigl avatar Nov 17 '25 15:11 danielsigl