GraphQL Yoga is a full-featured GraphQL server built on top of the Fetch API, running natively on Node.js, Bun, Deno, and edge runtimes. Its flexibility is excellent — but flexibility means you own the uptime story. A process crash, a plugin failure, or an SSL renewal lapse won't alert you on its own. Vigilmon gives you per-endpoint uptime checks, certificate monitoring, and alerting to keep your GraphQL Yoga server production-ready.
What You'll Set Up
- HTTP uptime monitor for the GraphQL endpoint
- Dedicated
/healthroute integrated with Yoga's plugin system - GraphQL query probe to verify execution engine health
- SSL certificate alerts for production domains
- Heartbeat for background event consumers
Prerequisites
- GraphQL Yoga 3+ (Node.js, Bun, or Deno)
- A running Yoga server accessible over HTTP/HTTPS
- A free Vigilmon account
Step 1: Add a Health Check Route
GraphQL Yoga's createYoga() handles the /graphql path by default. Add a separate /health route at the HTTP server layer so Vigilmon can probe with a plain GET:
Node.js with HTTP
import { createServer } from 'http';
import { createYoga } from 'graphql-yoga';
const yoga = createYoga({ typeDefs, resolvers });
const server = createServer((req, res) => {
if (req.url === '/health' && req.method === 'GET') {
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ status: 'ok', uptime: process.uptime() }));
return;
}
yoga(req, res);
});
server.listen(4000);
Node.js with Express
import express from 'express';
import { createYoga } from 'graphql-yoga';
const app = express();
const yoga = createYoga({ typeDefs, resolvers });
app.get('/health', (req, res) => {
res.json({ status: 'ok', uptime: process.uptime() });
});
app.use('/graphql', yoga);
app.listen(4000);
Bun
import { createYoga } from 'graphql-yoga';
const yoga = createYoga({ typeDefs, resolvers });
Bun.serve({
port: 4000,
fetch(req) {
const url = new URL(req.url);
if (url.pathname === '/health') {
return new Response(JSON.stringify({ status: 'ok' }), {
headers: { 'Content-Type': 'application/json' },
});
}
return yoga.fetch(req);
},
});
Step 2: Use Yoga's Plugin System for Richer Health Checks
GraphQL Yoga has a powerful plugin API. Create a health check plugin that verifies the schema is loaded and execution works:
import { createYoga, createSchema } from 'graphql-yoga';
let schemaReady = false;
const healthPlugin = {
onSchemaChange() {
schemaReady = true;
},
};
const yoga = createYoga({
schema: createSchema({ typeDefs, resolvers }),
plugins: [healthPlugin],
});
// Health route checks schema state
app.get('/health', (req, res) => {
if (!schemaReady) {
return res.status(503).json({ status: 'error', detail: 'schema not ready' });
}
res.json({ status: 'ok', schema: 'ready', uptime: process.uptime() });
});
This catches cases where the schema failed to build — Yoga will still start but resolve nothing.
Step 3: Add Vigilmon Monitors
Monitor 1: Health Endpoint
- Log in to vigilmon.online and click Add Monitor.
- Set Type to
HTTP / HTTPS. - Enter:
https://api.yourdomain.com/health - Set Check interval to
1 minute. - Set Expected HTTP status to
200. - Click Save.
Monitor 2: GraphQL Execution Probe
GraphQL Yoga returns HTTP 200 even for execution errors, so verify with a real query POST:
- Click Add Monitor → HTTP / HTTPS.
- Set Method to
POST. - Set URL to
https://api.yourdomain.com/graphql. - Add header
Content-Type: application/json. - Set Request body to
{"query":"{ __typename }"}. - Set Expected HTTP status to
200. - Optionally set Response must contain to
"data"to verify the response is a valid GraphQL response. - Click Save.
Step 4: SSL Certificate Monitoring
GraphQL Yoga is often deployed behind a reverse proxy (Caddy, nginx, Traefik) that handles TLS. Add a certificate monitor so you're alerted before Let's Encrypt renewal failures cause downtime:
- Open your HTTP monitor for the Yoga API.
- Enable Monitor SSL certificate.
- Set Alert when certificate expires in less than
21 days. - Click Save.
If your Yoga server runs on multiple subdomains (e.g. a federated setup with separate subgraph servers), add one SSL monitor per domain.
Step 5: Heartbeat for Subscriptions and Workers
GraphQL Yoga supports subscriptions via SSE (Server-Sent Events) out of the box. If the subscription process is separate, monitor it with a heartbeat:
- In Vigilmon, click Add Monitor → Cron Heartbeat.
- Set the expected ping interval (e.g.
5minutes). - Copy the heartbeat URL.
- Add a recurring ping in your server:
// Ping Vigilmon every 4 minutes from the Yoga process
const HEARTBEAT_URL = 'https://vigilmon.online/heartbeat/YOUR_KEY';
setInterval(async () => {
try {
await fetch(HEARTBEAT_URL);
} catch {
// non-fatal — Vigilmon will alert if pings stop
}
}, 4 * 60 * 1000);
For Deno or Bun environments, fetch is a global — no imports needed.
Step 6: Alert Channel Setup
- Go to Alert Channels in Vigilmon and add Slack, email, or PagerDuty.
- Set Consecutive failures before alert to
2— a single failed probe during a hot reload is normal. - Silence alerts during planned maintenance:
# Pause before restarting Yoga server
curl -X POST https://vigilmon.online/api/maintenance \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{"monitor_id": "YOUR_MONITOR_ID", "duration_minutes": 3}'
# Restart
pm2 restart graphql-yoga
# or: bun run start
Summary
| Monitor | Target | What It Catches |
|---|---|---|
| Health endpoint | /health | Process crash, schema build failure |
| GraphQL POST | /graphql with { __typename } | Execution engine failure, middleware error |
| SSL certificate | API domain | TLS cert expiry |
| Cron heartbeat | Subscription/worker process | Process crash between deployments |
GraphQL Yoga's runtime portability (Node.js, Bun, Deno, edge) is a strength — and Vigilmon's simple HTTP probe works the same way everywhere. With a health route, a real GraphQL probe, and SSL monitoring in place, you'll know about Yoga server failures before any GraphQL client does.