web / lib/jobs/workflows/process-sheets
lib/jobs/workflows/process-sheets
Shared sheet-processing pipeline used by all ingest workflows.
Runs the 6-task pipeline (analyze -> detect-schema -> validate -> create-schema-version -> geocode -> create-events) for each sheet in parallel via Promise.allSettled.
Error model:
- Tasks throw on failure -> caught by per-sheet try/catch -> markSheetFailed marks FAILED
- Tasks return output on success -> pipeline continues
- Tasks return { needsReview: true } -> pipeline pauses for human review
Review checks (duplicates, quota, geocoding) are performed inside the task handlers
themselves. This module only inspects the needsReview flag on task outputs.
IMPORTANT: onFail callbacks on task definitions do NOT fire inside workflow handlers when using Promise.allSettled, because Promise.allSettled catches the TaskError before it reaches Payload’s top-level error handler. The per-sheet try/catch + markSheetFailed is the correct mechanism for marking failures within workflows.
Functions
processSheets()
processSheets(
tasks,sheets,req):Promise<void>
Process sheets through the 6-task ingest pipeline in parallel.
Each sheet runs in its own try/catch — if a task throws, that sheet is marked FAILED and other sheets continue independently.
Parameters
tasks
RunTaskFunctions
sheets
req
payload
BasePayload
Returns
Promise<void>