โ† deemwar engineering examples Runnable ยท Node ยท zero deps ยท free

Your channel says "healthy" โ€” and it hasn't sent a message in hours.

A messaging channel with a session behind it โ€” WhatsApp Web, a paired device, an OAuth-backed API โ€” can go dark while the process stays up. /health answers "is the process alive," not "can this thing actually deliver," and those are different questions that quietly diverge.

The crux

We hit this running our own WhatsApp automation in production: the paired device went unauthenticated (needed a fresh QR scan) while the service process kept running untouched. The only check most /health handlers implement โ€” is the process alive and answering HTTP โ€” stayed green the entire time. Outbound messages queued instead of failing loudly; the first real signal was silence, not an alert.

function naiveHealth(channel) {
  return { ok: channel.alive };
}

That's a correct answer to the wrong question. The one that matters for anything session-based: is the session behind this endpoint currently authenticated, and has it proven that recently by actually sending something?

Run it

node check.js --demo

Zero dependencies, no network โ€” reproduces the class in ten lines: a channel that's alive, unauthenticated, and hasn't sent anything in 6 hours, checked two ways.

$ node check.js --demo Channel state: process alive, session unauthenticated, last successful send 6h ago. naive /health (liveness only): {"ok":true} corrected /health (auth + recency): {"ok":false,"alive":true,"authenticated":false,"staleMs":21600000} DIAGNOSIS: the naive check reports healthy while the channel cannot deliver a single message. Every downstream monitor that trusts /health goes quiet -- outbound queues, nothing pages, until someone notices sends are not arriving and checks by hand.

Against your own health endpoint (built-in http/https only, still zero deps):

node check.js --url http://localhost:PORT/health [--field authenticated]

It tells you one of three things: the JSON has no authenticated-state field at all (this failure class is invisible to you today), the field says false while the HTTP status says 200 (the false green, live), or the two agree.

The fix is two-part

Skip the second part and you've only moved the false green one hop later โ€” from "checks liveness" to "checks a flag that never gets updated."

Check your own system

Get the code