How to Monitor Your Deno Deploy Application with Vigilmon
Deno Deploy is a globally distributed serverless platform that runs JavaScript and TypeScript at the edge. With near-instant cold starts and no server management, it's increasingly popular — but edge deployments still need uptime monitoring.
This guide covers adding health check routes to your Deno Deploy app and connecting them to Vigilmon for external monitoring.
Why Monitor Deno Deploy Apps?
Deno Deploy has impressive reliability, but you still face risks from:
- Edge region outages (Deno's CDN can have regional issues)
- Upstream API failures (your app calls Stripe, SendGrid, etc.)
- Deployment failures that serve stale or broken code
- Deno KV or external database connectivity issues
- DNS propagation problems after domain changes
From inside your deployment, you can't tell if you are reachable from the internet. External monitoring solves this.
Step 1: Add a Health Endpoint
Deno Deploy uses Deno's native serve() or Deno.serve(). Add a health route:
// main.ts
Deno.serve(async (req: Request) => {
const url = new URL(req.url);
if (url.pathname === "/health") {
return await healthCheck();
}
// ... rest of your routing
return new Response("Not Found", { status: 404 });
});
async function healthCheck(): Promise<Response> {
const checks: Record<string, boolean> = {};
// Check Deno KV if you use it
try {
const kv = await Deno.openKv();
await kv.get(["health-probe"]);
checks.kv = true;
kv.close();
} catch {
checks.kv = false;
}
const allHealthy = Object.values(checks).every(Boolean);
return Response.json(
{
status: allHealthy ? "healthy" : "degraded",
checks,
region: Deno.env.get("DENO_REGION") ?? "unknown",
timestamp: new Date().toISOString(),
},
{ status: allHealthy ? 200 : 503 }
);
}
Step 2: Oak Framework Health Route
If you're using Oak (the most popular Deno web framework):
import { Application, Router } from "https://deno.land/x/oak@v12.6.1/mod.ts";
const router = new Router();
router.get("/health", async (ctx) => {
const startTime = Date.now();
// Probe an upstream dependency
let upstreamOk = true;
try {
const res = await fetch("https://api.stripe.com/", {
method: "HEAD",
signal: AbortSignal.timeout(3000),
});
upstreamOk = res.status < 500;
} catch {
upstreamOk = false;
}
const latency = Date.now() - startTime;
ctx.response.status = upstreamOk ? 200 : 503;
ctx.response.body = {
status: upstreamOk ? "healthy" : "degraded",
latencyMs: latency,
upstream: upstreamOk,
};
});
const app = new Application();
app.use(router.routes());
app.use(router.allowedMethods());
await app.listen({ port: 8000 });
Step 3: Fresh Framework
For apps built with Deno's Fresh framework, add a health route in /routes/health.ts:
// routes/health.ts
import { Handlers } from "$fresh/server.ts";
export const handler: Handlers = {
async GET(req) {
// Check your database (e.g., Supabase)
let dbOk = true;
try {
const res = await fetch(
`${Deno.env.get("SUPABASE_URL")}/rest/v1/`,
{
headers: {
apikey: Deno.env.get("SUPABASE_ANON_KEY") ?? "",
},
signal: AbortSignal.timeout(5000),
}
);
dbOk = res.ok;
} catch {
dbOk = false;
}
const status = dbOk ? "healthy" : "degraded";
return Response.json({ status, database: dbOk }, {
status: dbOk ? 200 : 503,
});
},
};
Fresh automatically routes /health requests to this handler.
Step 4: Monitor with Vigilmon
- Go to vigilmon.online and create an account
- Add new monitor → HTTP Monitor
- URL:
https://your-project.deno.dev/health - Check interval: 1 minute
- Expected status: 200
- Alert channels: email, Slack, or webhook
Vigilmon pings from multiple regions, so it catches regional edge failures that a single-region monitor might miss.
Step 5: SSL Monitoring
Deno Deploy provides automatic HTTPS via Let's Encrypt for custom domains. Add SSL monitoring in Vigilmon:
- Create a second monitor → SSL Certificate Monitor
- Point it to your custom domain
- Get alerts 30, 14, and 7 days before expiry
Even with auto-renewal, renewal failures happen. Catch them before users see certificate errors.
Deno Deploy-Specific Failure Modes
| Failure | Detectable Internally | Vigilmon |
|---|---|---|
| Edge region outage | No | ✅ |
| Deployment broke the app | No (if crash on startup) | ✅ |
| Cold start timeout | No | ✅ (response time alert) |
| Deno KV unavailable | Partially | ✅ via health endpoint |
| Custom domain DNS issue | No | ✅ |
| SSL cert failure | No | ✅ SSL monitor |
Using Vigilmon's Webhook for Deno Deploy Webhooks
You can use Vigilmon alerts to trigger Deno Deploy webhooks for auto-remediation. When Vigilmon detects downtime, it POSTs to your webhook URL:
// routes/vigilmon-webhook.ts - auto-redeploy trigger
export const handler: Handlers = {
async POST(req) {
const body = await req.json();
if (body.event === "down" && body.monitor_url.includes("api")) {
// Notify your on-call channel
await fetch(Deno.env.get("SLACK_WEBHOOK")!, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
text: `🚨 ${body.monitor_name} is DOWN. Check Deno Deploy dashboard.`
}),
});
}
return new Response("ok");
}
};
Free Tier for Side Projects
Vigilmon's free plan covers:
- 5 monitors
- 1-minute check intervals
- Email + webhook alerts
- 90 days of uptime history
Perfect for Deno Deploy hobby projects and production side projects. No credit card required.
Summary
- Add a
/healthroute returning200when healthy and503when degraded - Check your actual dependencies (KV, databases, external APIs)
- Connect Vigilmon for external 1-minute pings
- Add SSL monitoring for your custom domain
- Set up webhook alerts for instant notification
Deno Deploy handles your infrastructure. Vigilmon handles your visibility.
Start monitoring free at vigilmon.online
Top comments (0)