Skip to content
Ritesh FirodiyaGet in touch

Work / Chitragupt / Wiki / Decisions

2026-07-02-rename-on-consult-paid-trigger

Decisioncanonicalverified 2026-07-02

DECISION.2026-07-02.RENAME-ON-CONSULT-PAID-TRIGGER

Rename onConsultPaid → onConsultRequestPaid

Decision

Rename the Firestore trigger that mints an engagement when a consult request flips to paid_pending_assignment. Old export: onConsultPaid (file on-consult-paid.ts). New export: onConsultRequestPaid (file on-consult-request-paid.ts).

Why

Prod already held an HTTPS callable named onConsultPaid from an earlier iteration. When the callable was replaced with an onDocumentWritten Firestore trigger under the same name, every deploy failed with:

[onConsultPaid(asia-south1)] Changing from an HTTPS function to a background triggered function is not allowed.

Firebase does not allow swapping a function's trigger type in place. CI has been red on main for four consecutive pushes (runs 28541508160, 28546196065, 28563416150, 28564780202) with the same error. Renaming the function makes Firebase treat it as a new deployment; the orphaned HTTPS onConsultPaid is then deleted in the same deploy via the existing --force flag.

Impact

  • apps/functions/src/triggers/firestore/on-consult-paid.ts → renamed to on-consult-request-paid.ts; export renamed accordingly.
  • apps/functions/src/index.ts re-export updated.
  • packages/shared/src/schemas/consult-request.ts doc comment updated.
  • No callable-contract or Firestore-schema change — the trigger listens to the same users/{uid}/consult_requests/{consultId} path.
  • Affects the pillar-marketplace Get-a-CA flow. Idempotency is preserved (still keyed on consult_${consultId}).

Status

Active.

Sources

  • CI run 28564780202 (design alignment, main, 2026-07-02) — failing step "Deploy Firebase".
  • apps/functions/src/triggers/firestore/on-consult-request-paid.ts — trigger implementation.

Every project of mine is written down like this.

Read the résumé