Skip to content

fix(uptime): configure uptime-checker API endpoint for Test Monitor and assertion validation - #4583

Merged
aldy505 merged 1 commit into
getsentry:masterfrom
ayoubjemai:fix/uptime-checker-api-endpoint
Oct 25, 2026
Merged

aldy505 merged 1 commit into
getsentry:masterfrom
ayoubjemai:fix/uptime-checker-api-endpoint

Conversation

@ayoubjemai

Copy link
Copy Markdown
Contributor

Fixes #4582

Problem

"Test Monitor" fails when creating a new uptime monitor. The button shows "Uptime check failed" with no reason, for any URL (even https://example.com with a single status code = 200 assertion). The API call behind it returns HTTP 400 with an empty body:

POST /api/0/organizations/sentry/uptime-preview-check/
HTTP/1.1 400 Bad Request
Content-Length: 0

A second effect: invalid assertions (for example a broken JSONPath like $.[[) are saved without any validation error. Scheduled uptime checks keep working.

Root cause

The uptime-checker container exposes an HTTP API on port 12345, which Sentry uses to run the Test Monitor preview and to validate assertions. But Sentry's default uptime region has no API endpoint (api_endpoint defaults to ""), and the self-hosted config never sets it. So on self-hosted, those calls are silently skipped: Sentry never calls the checker, Test Monitor returns an empty 400, and assertion validation does nothing.

The button became visible on self-hosted when the feature flag was removed in getsentry/sentry#110478.

Fix

Override UPTIME_REGIONS in sentry/sentry.conf.example.py with the same default region plus api_endpoint="uptime-checker:12345": the uptime-checker service name on the Docker network and its default webserver port. Scheduled checks don't use this endpoint (they go through Redis and Kafka), so they're unaffected.

How I tested it

I ran the latest self-hosted release (26.10.0, fresh install, COMPOSE_PROFILES=feature-complete, no .env.custom) on an AWS EC2 instance (Ubuntu 24.04, Docker 29.9.2, Compose v5.6.1) and reproduced the error with https://example.com before the fix, both through the API and the UI.

Before the fix:

  • settings.UPTIME_REGIONS → [('default', 'Default Region', 'default', '')]
  • Test Monitor (API and UI) → 400, empty body; the uptime-checker received no request
  • Calling the checker directly from the web container (POST http://uptime-checker:12345/execute_config) → 200, so the API itself works
  • A monitor with assertion $.[[ → saved (200), while the checker's own /validate_check rejects it with compilation_error

After adding the block and restarting web and taskworker:

  • example.com, status = 200 → 200, "status": "success"
  • example.com, status = 201 → 200, "status": "failure", "Assertion failed"
  • non-existent domain → 200, "status": "failure", dns_error
  • JSONPath on https://api.github.com (UI) → "Uptime check passed successfully"
  • assertion $.[[ on create → 400 {"assertion": {"error": "compilation_error", …}}, not saved
  • existing monitor's scheduled checks → still success every minute
08-ui-baseline 14-ui-after 15-ui-invalid-jsonpath

Existing installs

Fresh installs get the fix automatically. Existing installs don't: install.sh only creates sentry/sentry.conf.py when it's missing, so running it again changes nothing. Those users need to add the same block to their sentry/sentry.conf.py by hand and restart (docker compose restart web taskworker).

Would you like a follow-up PR with a migration script (like install/migrate-pgbouncer.sh) that detects a missing UPTIME_REGIONS and adds it, or is a release note enough?


I'm a big fan of this project, and it helps me a lot in my daily work. Thanks for building it!

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

@aldy505
aldy505 merged commit d03c262 into getsentry:master Oct 25, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Uptime "Test Monitor" always fails with an empty HTTP 400 (uptime-checker API endpoint not configured)

2 participants