Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt

Use this file to discover all available pages before exploring further.

The FW-46 edge function workflow-executor-worker needs to be scheduled via pg_cron to process queued workflow executions.

Prerequisites

Enable extensions in the Supabase Dashboard → Extensions:
  • pg_cron
  • pg_net
Ensure util.invoke_edge_function is available and app.settings.service_role_key is configured in Vault.

Scheduling SQL

Run this in the Supabase SQL Editor (NOT as a migration — it uses the util.invoke_edge_function helper which depends on project-specific Vault settings):
-- Process workflow execution queue — every minute
SELECT cron.schedule(
  'process-workflow-queue',
  '* * * * *',
  $$SELECT util.invoke_edge_function('workflow-executor-worker', '{}'::jsonb);$$
);
Note: If second-level pg_cron scheduling is available, use */10 * * * * * (every 10 seconds) for lower latency.

Verification

-- Verify the job is registered
SELECT jobid, jobname, schedule, command
FROM cron.job
WHERE jobname = 'process-workflow-queue';

-- Check recent run history
SELECT jobid, job_name, status, return_message, start_time, end_time
FROM cron.job_run_details
WHERE job_name = 'process-workflow-queue'
ORDER BY start_time DESC
LIMIT 20;

Managing the Cron Job

-- List all scheduled jobs
SELECT * FROM cron.job;

-- Pause the worker (unschedule)
SELECT cron.unschedule('process-workflow-queue');

-- Re-enable after pause
SELECT cron.schedule(
  'process-workflow-queue',
  '* * * * *',
  $$SELECT util.invoke_edge_function('workflow-executor-worker', '{}'::jsonb);$$
);

Troubleshooting

SymptomCheck
Job not runningSELECT * FROM cron.job WHERE jobname = 'process-workflow-queue'; — is it registered?
Job runs but worker does nothingCheck fw_module_settings.fw_execution_worker_enabled — is any org enabled?
Worker skips orgsCheck fw_module_settings.worker_running — stuck semaphore? Reset with runbook.
Edge function errorsCheck Edge Function logs in Supabase Dashboard.