Liveness check, optionally with the database
const url = 'https://api.proofql.dev/health?deep=1';const options = {method: 'GET'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://api.proofql.dev/health?deep=1'Without deep: always { "ok": true } when the worker is up. It
touches no database, so it is safe to poll every minute.
With deep=1: also runs one statement against Postgres (5 s
timeout) and answers 503 when it fails. Every deep call reaches the
database, and wakes it when it has scaled to zero, so poll it no
more often than every 30 minutes. No authentication.
Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”1 to include the database check. Any other value is ignored.
Responses
Section titled “Responses”The worker is serving requests (and, with deep=1, Postgres answered).
object
Present with deep=1.
object
Round trip of the check, in milliseconds.
Examples
{ "ok": true}{ "ok": true, "db": { "ok": true, "ms": 12 }}Headers
Section titled “Headers”This request’s id, on every response. Reuses the caller’s
x-request-id when sent (up to 128 chars), else Cloudflare’s ray id,
else a fresh UUID. Also inside every error envelope.
deep=1 only: Postgres did not answer, or the statement failed.
object
object
timeout: no answer within 5 s. failed: the statement returned an error.
Examples
{ "ok": false, "db": { "ok": false, "error": "timeout", "ms": 5001 }}Headers
Section titled “Headers”This request’s id, on every response. Reuses the caller’s
x-request-id when sent (up to 128 chars), else Cloudflare’s ray id,
else a fresh UUID. Also inside every error envelope.