Skip to content

[server] - Add Webhook Retry Logic and Dead-Letter Queue #118

Description

@dark-sarge

Location: server/src/routes/webhooks.ts, server/src/jobs/processors/

Description

Paystack may re-deliver webhooks if the server does not respond in time. Currently there is no idempotency layer beyond the Paystack reference check. Additionally, failed webhook processing (e.g. due to a temporary database outage) has no retry mechanism, meaning events could be permanently lost.

Acceptance Criteria

  • A webhook_events table is created with columns: id, provider (paystack), event_type, payload (JSONB), processed_at, status (pending, processed, failed).
  • On receipt of a valid Paystack webhook, the raw payload is immediately persisted to webhook_events with status: pending before any processing begins.
  • A BullMQ job is enqueued to process the event asynchronously; the HTTP response returns 200 immediately.
  • If the job processor fails, BullMQ retries up to 3 times with exponential backoff. After 3 failures the event is marked failed and an admin alert is sent.
  • A GET /api/admin/webhooks (admin only) endpoint lists failed webhook events with their payloads for manual inspection and replay.
  • A POST /api/admin/webhooks/:id/replay (admin only) re-enqueues a failed webhook event for reprocessing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave program

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions