DEV Community

Domonique Luchin
Domonique Luchin

Posted on

The pg_cron Bug That Silently Killed My Content Pipeline for Weeks

For weeks my content pipeline was running. Zero posts were going out. No errors in the logs.

Here is what happened.

The Setup

I use pg_cron on Supabase to schedule content jobs. A cron job fires every hour, calls an edge function, and the function posts queued articles to dev.to.

Simple enough.

The Symptom

Articles were sitting in the queue with status ready. The cron job showed successful execution in cron.job_run_details. The edge function showed 200 responses.

Nothing was posting.

The Root Cause

The edge function was calling the dev.to API with an Authorization header formatted as:

Authorization: api_key YOUR_KEY
Enter fullscreen mode Exit fullscreen mode

Dev.to expects:

api-key: YOUR_KEY
Enter fullscreen mode Exit fullscreen mode

The header name was wrong. The API returned a 401. The edge function caught the error, logged it to a column I was not monitoring, and returned 200 to pg_cron anyway.

The job looked healthy. The posts never went out.

The Fix

Correct the header. Add explicit error surfacing so a failed post sets status to error and writes the response body to error_message.

UPDATE build_content_queue 
SET status = 'error', error_message = $1 
WHERE id = $2;
Enter fullscreen mode Exit fullscreen mode

What I Changed Going Forward

  1. Never trust a 200 from your own wrapper. Inspect the downstream response code.
  2. Write failures visibly — status column, not just a log.
  3. Add a daily alert if zero posts go out in a 24-hour window.

Silent failures are the worst kind. They look like everything is working until you check the actual output.

Top comments (0)