Pact Broker Webhooks Drop on Provider Redeploy

Pact contract testing works until it quietly doesn't. Teams running Pact across microservices often configure Broker webhooks once, confirm the first few triggers fire, and move on. Then a provider redeploys — same version tag, different build artifact — and the webhook that should re-trigger consumer verification never fires. The pipeline goes green. The contract is stale. Production breaks on a schema field that changed three sprints ago.

The root cause isn't a Pact bug. It's a combination of how the Broker evaluates webhook trigger conditions against version metadata and how most CD pipelines publish provider versions. The gap is architectural, not incidental.

By the end of this article you'll know exactly why webhook triggers drop on redeploy, how to reproduce the failure in a controlled way, and what pipeline and Broker configuration changes close the gap permanently. The patterns apply to both the hosted PactFlow and self-hosted Pact Broker 2.x.

Build an API Automation Framework in Python

Learn Python, Behave, GitHub Copilot, APIs, and CI/CD by building a real framework you can finish in a weekend.

Learn more

Why the Broker Treats a Redeploy as a No-Op

The Pact Broker fires a provider verification webhook when a new pact version is published by a consumer, or — critically — when a provider version is tagged. The trigger condition is an event, not a state. If the provider CI job republishes the same version string (e.g., 1.4.7) with a new deployed or prod tag, the Broker sees a tag update on an already-known version. Depending on Broker version and configuration, that event may not satisfy the contract_requiring_verification_published trigger because no new pact content exists. The webhook simply does not fire.

This matters most in GitOps and rollback scenarios: a provider is redeployed at a previous Git SHA, the version string is identical to one already in the Broker, and the environment tag moves back. No new pact, no new provider version — no webhook. The schema drift that accumulates between deploys is never re-verified against the current consumer expectations. The can-i-deploy gate only catches this if it's actually blocking, which many teams set to advisory-only.

Reproducing and Fixing the Dropped Webhook

First, reproduce the failure locally against a self-hosted Broker so you can observe it deterministically. Publish a consumer pact, trigger verification, then re-tag the same provider version and watch the webhook log.

# Publish consumer pact (Pact CLI 1.x)
pact-broker publish ./pacts \
  --broker-base-url http://localhost:9292 \
  --consumer-app-version 2.1.0 \
  --branch main

# Simulate first deploy — new provider version
pact-broker create-version-tag \
  --pacticipant OrderService \
  --version 1.4.7 \
  --tag prod \
  --broker-base-url http://localhost:9292

# Simulate redeploy — same version, tag re-applied
pact-broker create-version-tag \
  --pacticipant OrderService \
  --version 1.4.7 \
  --tag prod \
  --broker-base-url http://localhost:9292

Check GET /webhooks/execute logs in the Broker UI. The second create-version-tag call generates no webhook entry because the Broker deduplicates tag events on already-published versions. The fix is to ensure every redeploy publishes a distinct provider version string — not just a new tag. The most reliable approach is including the build number or commit SHA in the version.

# GitHub Actions — always unique provider version
- name: Publish provider version to Pact Broker
  env:
    PACT_BROKER_BASE_URL: ${{ secrets.PACT_BROKER_URL }}
    PACT_BROKER_TOKEN: ${{ secrets.PACT_BROKER_TOKEN }}
  run: |
    VERSION="${GITHUB_SHA:0:8}-${GITHUB_RUN_NUMBER}"
    pact-broker create-or-update-version \
      --pacticipant OrderService \
      --version "$VERSION" \
      --branch "$GITHUB_REF_NAME"
    pact-broker create-version-tag \
      --pacticipant OrderService \
      --version "$VERSION" \
      --tag prod

With a unique version per build, every deploy — including rollbacks — publishes a new version string. The Broker now sees a new provider version being tagged into an environment, which satisfies the provider_verification_required event and fires the webhook. Run time for the full verify-and-gate loop in a well-tuned pipeline drops from the 18-minute polling interval (common in teams using scheduled verification) to under 90 seconds on webhook delivery.

If you cannot change the versioning scheme (legacy monorepo, shared artifact), configure a fallback scheduled webhook as a safety net. In PactFlow, this is a cron-style trigger; in self-hosted Broker 2.x, you wire it through an external scheduler hitting the webhook execute endpoint directly. Also audit your CI shard timeout settings — a webhook that fires but whose downstream verification job is killed by a shard timeout produces the same silent-green outcome.

# Pact Broker webhook payload — POST to your CI trigger endpoint
{
  "events": [
    { "name": "contract_requiring_verification_published" },
    { "name": "provider_verification_published" }
  ],
  "request": {
    "method": "POST",
    "url": "https://ci.internal/job/OrderService-pact-verify/build",
    "headers": { "Authorization": "Bearer ${pactbroker.ciToken}" },
    "body": {
      "pact_url": "${pactbroker.pactUrl}",
      "provider_version_branch": "${pactbroker.providerVersionBranch}"
    }
  }
}

The contract_requiring_verification_published event covers new consumer pacts; adding provider_verification_published ensures the loop closes when a provider publishes results. Both events are required if you want the Broker's verification status to stay current without manual intervention.

Pipeline Patterns That Mask the Missing Trigger

The most common mistake is treating can-i-deploy as advisory rather than a hard gate. Teams add --dry-run during initial rollout and never remove it. When a webhook drops and verification goes stale, can-i-deploy returns a warning that nobody is watching, and the deploy proceeds. The fix is mechanical: remove --dry-run in production pipelines and wire the non-zero exit code to a pipeline failure. Painful the first time; essential after that.

A subtler issue is environment tag collision in blue-green deploys. Both the blue and green slots get tagged prod during cutover. If both slots run the same artifact version, the Broker may receive two tag events for the same version string within seconds. Only one webhook fires, and it may target the slot that's about to be drained. Pair this with provider state hooks that silently fail during slot warm-up, and you get a verification result that's structurally valid but semantically wrong — the hook ran against a cold cache and returned 200 for data that doesn't exist yet.

What Pact Microservice Testing Teams Get Wrong About Webhooks

Myth 1: a successful webhook delivery means verification ran. The Broker records a 2xx response from your CI trigger endpoint as a successful webhook. If that endpoint queues the job but the job never starts (queue saturation, agent pool exhausted), the Broker shows green and verification never happened. Instrument the actual verification job completion separately — OpenTelemetry spans on the verify step, or a Broker API poll on /pacts/provider/{provider}/consumer/{consumer}/latest — not just webhook delivery status.

Myth 2: api schema drift checks with Pact are continuous by default. Pact verifies the contract at a point in time. If your provider schema evolves between consumer pact publications and no new pact is published, the Broker has no trigger to fire. This is the scenario where broker schema evolution silently breaks verification — the contract looks verified because the last run passed, but that run predates the schema change. Scheduled verification (daily at minimum, hourly in active release cycles) is the only reliable backstop. Webhooks are fast-path; schedules are the safety net. You need both.

The webhook drop on provider redeploy is a configuration problem, not a Pact limitation. Enforce unique version strings per build, subscribe to both contract_requiring_verification_published and provider_verification_published events, and make can-i-deploy a hard gate. Once that's in place, the next measurement worth tracking is mean-time-to-detect on a schema field removal — if it's over 10 minutes, your scheduled verification cadence needs tightening.

Note: This article is for informational purposes only and is not a substitute for professional advice. If you need guidance on specific situations described in this article, consider consulting a qualified professional.

Understanding how systems actually work is the first step toward navigating them effectively.

Browse all articles