Firebase Cloud Functions: error alerts on your phone

July 14, 2026 · 4 min read

Cloud Logging has the error. Crashlytics has your app’s crashes. But when a payment webhook or signup function fails on the server at 9 p.m., nothing rings. One fetch call in your catch block fixes that.

The pattern

Create an endpoint called “Errors” in the Webhooky app, pick an alarm sound, and add this to any function you care about (Node 18+ has global fetch):

const {onRequest} = require("firebase-functions/v2/https");

exports.checkout = onRequest(async (req, res) => {
  try {
    await processOrder(req.body);
    res.json({ ok: true });
  } catch (err) {
    await fetch("https://api.webhooky.app/ERROR_KEY", {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({
        title: "🚨 checkout failed",
        message: String(err).slice(0, 400),
      }),
    }).catch(() => {});
    throw err;
  }
});

The .catch(() => {}) matters: your alert must never mask the original error. The notification title and message are per-request overrides – one “Errors” endpoint covers your whole backend and the push itself tells you which function broke.

A reusable helper

async function pushAlert(title, message, sound = "error_1") {
  try {
    await fetch(process.env.WEBHOOKY_URL, {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({ title, message, sound }),
    });
  } catch (_) { /* never break the caller */ }
}

Store the endpoint URL as an environment variable (firebase functions:config or .env) and call pushAlert() from any catch block, scheduled job or trigger.

Good news deserves a sound too

The same one-liner in your payment success handler gives you a cash-register cha-ching for every sale, and a level-up sound for every new signup. Use separate endpoints so each has its own sound – after a day you can hear the difference between revenue and trouble without looking at your phone.

Why not Cloud Monitoring alerts?

Google Cloud alerting is powerful but heavyweight: alert policies, notification channels, delays of minutes. For a solo developer or small team, a POST in the catch block is instant, free to set up, and tells you exactly what happened – in about a second.

Get Webhooky

Free for your first 100 notifications – set up your endpoint in two minutes.

Get it on Google Play Download on the App Store