Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

287
Views
Must we manually log errors in Firebase Cloud Functions or will they log automatically?

I have this cloud function currently deployed. It returns a promise as required by Firebase to terminate the function.

exports.userDidSignOut = functions.https.onCall((data) => {
    const userId = data.userId;
    const settingsUpdate = {
        "fcmToken": null,
    };
    const promise = admin.firestore().collection("user-settings").doc(userId).update(settingsUpdate);

    return promise
});

However, will this log errors on the console automatically? Or must I log them manually (as below)?

exports.userDidSignOut = functions.https.onCall((data) => {
    const userId = data.userId;
    const settingsUpdate = {
        "fcmToken": null,
    };
    const promise = admin.firestore().collection("user-settings").doc(userId).update(settingsUpdate);

    promise.then(() => {
        return null;
    }, (reason) => {
        console.log(reason);
        return null;
    });
});

And is it necessary to return null in the failure function to terminate the cloud function or is printing to the console sufficient?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

There's an entire documentation page on handling errors in Cloud Functions. From there:

Uncaught exceptions produced by your function will appear in Error Reporting.

So you don't have to do this yourself, although you can of course always do so to add additional context around the error.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!