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
}
}
}