0

Tried to deploy the functions script to firebase cloud functions. But couldn't deploy with the error below.

i functions: cleaning up build files... Error: There was an error deploying functions:

  • Error Failed to update function XXXXXXXXXXX in region us-central1

How to successfully deploy into the server?

import { MAILGUN_API_KEY, MAILGUN_DOMAIN } from "../config";
import * as formData from "form-data";
import Mailgun from "mailgun.js";

const mailgun = new Mailgun(formData);

const mailgunClient = mailgun.client({
  username: 'api',
  key: MAILGUN_API_KEY,
})

export class MailgunService {
  static async sendEmail(
    to: string,
    subject: string,
    text: any,
  ) {
    try {
      mailgunClient.messages
      .create(MAILGUN_DOMAIN, {
        from: `Test<test@example.com>`,
        to,
        subject,
        text,
      })
      .then((msg) => console.log('msg', msg))
      .catch((err: string) => console.log('error', err))
    } catch (error) {
      console.log(`send email error: %o', ${error}`)
      return
    }
  }
}
k10a
  • 947
  • 2
  • 11
  • 30
  • Does this answer your question? [Firebase cloud function deploy error](https://stackoverflow.com/questions/44596181/firebase-cloud-function-deploy-error) – Martin Zeitler May 15 '22 at 09:20
  • Have you gone through this similar [thread](https://stackoverflow.com/questions/69989040/google-firebase-functions-deployment-fails-what-can-i-do)? – Roopa M May 16 '22 at 07:58

0 Answers0