Skip to main content

Overview

The health check endpoint provides a simple way to monitor the status of Money Tracker’s backend Edge Functions. It returns basic service information and can be used by monitoring tools or load balancers.

Endpoint

GET /health

Authentication

No authentication required. This is a public endpoint.

Request

This endpoint accepts no parameters.
cURL
curl https://your-project.supabase.co/functions/v1/health

Response

Success Response (200)

status
string
Service status - always “ok” when healthy
check_timestamp
string
ISO 8601 timestamp of the health check
version
string
Platform identifier - “supabase-edge-functions”
service
string
Service name - “money-tracker-backend”
environment
string
Current environment (development, staging, production)
Example Response
{
  "status": "ok",
  "check_timestamp": "2024-03-15T10:30:00.000Z",
  "version": "supabase-edge-functions",
  "service": "money-tracker-backend",
  "environment": "production"
}

Error Response (500)

status
string
Service status - “error” when unhealthy
check_timestamp
string
ISO 8601 timestamp of the failed check
error
string
Error message
Error Response
{
  "status": "error",
  "check_timestamp": "2024-03-15T10:30:00.000Z",
  "error": "Health check failed"
}

Use Cases

Monitoring Systems

Configure your monitoring tools (like UptimeRobot, Pingdom, or Datadog) to periodically check this endpoint:
# Simple availability check
curl -f https://your-project.supabase.co/functions/v1/health || echo "Service down"

Load Balancer Health Checks

If deploying behind a load balancer, configure it to use this endpoint for health checks with a 200 status code as the success condition.

CI/CD Pipeline Verification

Use this endpoint in deployment scripts to verify the service is running after deployment:
Deployment Script
#!/bin/bash
# Wait for service to be healthy
for i in {1..30}; do
  if curl -f https://your-project.supabase.co/functions/v1/health; then
    echo "Service is healthy"
    exit 0
  fi
  echo "Waiting for service to be healthy..."
  sleep 2
done
echo "Service health check timeout"
exit 1

Implementation Details

This endpoint:
  • Responds within milliseconds
  • Does not check database connectivity (basic service health only)
  • Returns environment information from the ENVIRONMENT environment variable
  • Uses CORS headers to allow cross-origin requests
This is a lightweight health check that only verifies the Edge Function runtime is responding. It does not test database connectivity or external service availability.

Build docs developers (and LLMs) love