DiUS / pact_broker-docker

'Dockerised' pact broker
http://pact.io
MIT License
76 stars 102 forks source link

Webhook not triggered with multiple providers after deleting one webhook #88

Closed neelofer closed 5 years ago

neelofer commented 5 years ago

Pre issue-raising checklist

I have already (please mark the applicable with an x):

Software versions

Expected behaviour

Webhook for contract change is triggered on provider

Actual behaviour

Webhook is not triggered on provider

Steps to reproduce

  1. Consumer C has two providers, P1 and P2.
  2. Pacts and contract_content_changed webhooks are created for both C-P1 and C-P2 combinations.
  3. Delete the webhook and latest pact version between C and P1.
  4. Recreate the webhook between C and P1.
  5. Publish a contract with contract change.

Our webhook for contract change:


  "consumer": {
    "name": "..."
  },
  "provider": {
    "name": "..."
  },
  "request": {
    "method": "POST",
    "url": "{provider build link}",
    "headers": {
      "Content-Type": "application/x-www-form-urlencoded",
      "Accept": "application/json",
      "Jenkins-Crumb": "..."
    },
    "body": "json={\"parameter\":[{\"name\": \"CONSUMER_GITHUB_PROJECT\",\"value\": \"...\"},{\"name\": \"CONSUMER_NAME\",\"value\": \"${pactbroker.consumerName}\"},{\"name\": \"VERIFICATION_URL\",\"value\": \"${pactbroker.verificationResultUrl}\"},{\"name\": \"PROVIDER_VERSION\",\"value\": \"${pactbroker.providerVersionNumber}\"},{\"name\": \"CONSUMER_VERSION\",\"value\": \"${pactbroker.consumerVersionNumber}\"},{\"name\": \"PROVIDER_TAGS\",\"value\": \"${pactbroker.providerVersionTags}\"},{\"name\": \"CONSUMER_TAGS\",\"value\": \"${pactbroker.consumerVersionTags}\"}]}}",
    "username": "...",
    "password": "..."
  },
  "events": [
    {
      "name": "contract_content_changed"
    }
  ]
}```

To fix this issue:
Delete webhooks between both `C` and `P1` and between `C` and `P2` at step 3. And then do the steps above. The webhook then created will be triggered.

## Relevent log files
```App 373 output: E, [2019-04-04T10:17:37.341770 #373] ERROR -- : PG::ForeignKeyViolation: ERROR:  update or delete on table "pact_publications" violates foreign key constraint "triggered_webhooks_pact_publication_id_fkey" on table "triggered_webhooks"
App 373 output: DETAIL:  Key (id)=(1172) is still referenced from table "triggered_webhooks".: DELETE FROM "pact_publications" WHERE ("consumer_version_id" = 755)
App 373 output: E, [2019-04-04T10:17:37.342049 #373] ERROR -- : PG::ForeignKeyViolation: ERROR:  update or delete on table "pact_publications" violates foreign key constraint "triggered_webhooks_pact_publication_id_fkey" on table "triggered_webhooks"
App 373 output: DETAIL:  Key (id)=(1172) is still referenced from table "triggered_webhooks".```
bethesque commented 5 years ago

Thanks. Please close this and raise the issue in the pact-foundation/pact_broker repository. As stated in the first point, this repo is only for the dockerizarion of the application. The issue you have is with the Pact Broker itself.

neelofer commented 5 years ago

Sorry about that, I accidentally opened the wrong Github link.

https://github.com/pact-foundation/pact_broker/issues/268