I am trying to email myself OnCreate of my firebase database. I am receiving the error "Ignoring exception from a finished function" when testing this in google cloud functions.
const functions = require('firebase-functions');
const nodemailer = require('nodemailer');
const gmailEmail = functions.config().gmail.email;
const gmailPassword = functions.config().gmail.password;
const mailTransport = nodemailer.createTransport({
service: 'gmail',
auth: {
user: gmailEmail,
pass: gmailPassword,
},
});
const APP_NAME = 'Your App';
exports.sendWelcomeEmail = functions.database.ref('/PickupRequests{pushID}').onCreate((snapshot, context) => {
return sendWelcomeEmail();
});
async function sendWelcomeEmail() {
const mailOptions = {
from: "<noreply@firebase.com>",
to: "info@abc.com",
subject: "New Request"
};
await mailTransport.sendMail(mailOptions);
return console.log("Success!");
}
I expect to receive an email but instead I am receiving the error from Google Cloud tester that states "Ignoring exception from a finished function" despite the fact that the console is also returning "Success!". Here is the complete error:
"textPayload": "Ignoring exception from a finished function", "insertId": "000000-5e081b31-9b2f-4f9a-a6a6-6c7ca4d38814", "resource": { "type": "cloud_function", "labels": { "project_id": "your-app", "region": "us-central1", "function_name": "sendWelcomeEmail" } }, "timestamp": "2019-05-31T00:56:56.926Z", "severity": "DEBUG", "labels": { "execution_id": "jbvvfsrrf8yz" }, "logName": "projects/your-app/logs/cloudfunctions.googleapis.com%2Fcloud-functions", "trace": "projects/your-app/traces/5af3a317b80ee34154c1caf1536fc16e", "receiveTimestamp": "2019-05-31T00:57:02.981796854Z" }