Skip to content

🐛 [firestore-send-email] Error "At least one of html, text and template_id should be set" when creating a Firestore doc to trigger the extension #2503

@rtarnec

Description

@rtarnec

Describe your configuration

  • Extension name: firestore-send-email
  • Extension version: 0.2.4
  • Sendgrid micro-service provider

Describe the problem

When testing the extension after a successful installation I get an error "Error: Failed to send email. At least one of html, text and template_id should be set"

Steps to reproduce:

Create a document in the collection configured in the Extension (i.e. "emails" in my case) by either using the Firestore console or by using the admin SDK (see below). The document contains a "to" field and a "message" map which contains a "subject" field and a "text" field or an "html" field or both of them.

admin
  .firestore()
  .collection("emails")
  .add({
    to: "[email protected]",
    message: {
      subject: "Hello from Firebase!",
      text: "This is the plaintext section of the email body.",
      html: "This is the <code>HTML</code> section of the email body.",
    },
  })
  .then(() => console.log("Queued email for delivery!"))
  .catch((error) => {
    console.log(error);
  });
Expected result
  • Automatic creation of a "delivery" map field with a "state" field set to SUCCESS and an "error" field set to null
  • Receive the email
  • See the email in the Sendgrid console
Actual result
  • Creation of a "delivery" map field with a "state" field set to ERROR and an "error" field with the following value: "Error: Failed to send email. At least one of html, text and template_id should be set."
  • No email delivered
  • No email in the Sendgrid console
Screenshot of the Firestore console:
Image

Metadata

Metadata

Assignees

Labels

type: bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions