Antonio
06/27/2024, 12:45 PMpact-broker:
image: pactfoundation/pact-broker:latest
ports:
- "9292:9292"
depends_on:
- postgres
environment:
PACT_BROKER_PORT: '9292'
PACT_BROKER_DATABASE_URL: "<postgres://postgres:CHANGE_ME@postgres/postgres>"
PACT_BROKER_LOG_LEVEL: INFO
PACT_BROKER_SQL_LOG_LEVEL: DEBUG
PACT_BROKER_DATABASE_CONNECT_MAX_RETRIES: "5"
PACT_BROKER_BASE_URL: '<https://localhost> <http://localhost> <http://localhost:9292> <http://pact-broker:9292> <https://host.docker.internal> <http://host.docker.internal> <http://host.docker.internal:9292>'
PACT_BROKER_BASIC_AUTH_ENABLED: true
PACT_BROKER_BASIC_AUTH_USERNAME: 'pactBrokerUsername'
PACT_BROKER_BASIC_AUTH_PASSWORD: 'pactBrokerUserPassword'
PACT_BROKER_WEBHOOK_SCHEME_WHITELIST: 'https, http'
PACT_BROKER_WEBHOOK_HOST_WHITELIST: 'localhost'
Then, I start anothe rdocker container with a simple Spring Boot app that accepts POST at http://localhost:9300. I also create a webhook using the following line:
docker run --rm -v ${PWD}:${PWD} --network="host" pactfoundation/pact-cli broker \
create-or-update-webhook <http://localhost:9300/notifications> --uuid "1662acf91d16ed1951da4b67a9ea8f37a844bbe3" \
--request POST --broker-base-url=<http://localhost:9292> \
--broker-username pactBrokerUsername --broker-password pactBrokerUserPassword \
--data '{ "event_type": "provider_verification_failed","client_payload": { "pact_url": "<http://localhost:9292>", "sha": "sha", "branch":"master" , "message": "Provider verification failed!" } }' \
--header 'Content-Type: application/json' 'Accept: application/json' \
--provider "bm" --provider_verification_failed \
--description "Provider verification failed!"
Everything goes smooth until I lead a verification to fail, in which case I can see the webhook retrying with the following error:
[2024-06-27T12:17:35Z] DEBUG: Webhook context {"base_url":"<http://localhost:9292>","build_url":null,"provider_version_tags":["eescp_openapi_gradle"],"event_name":"provider_verification_failed"}
[2024-06-27T12:17:35Z] INFO: HTTP/1.1 POST <http://localhost:9300/notifications>
[2024-06-27T12:17:35Z] INFO: accept: application/json
[2024-06-27T12:17:35Z] INFO: user-agent: Pact Broker v2.110.0
[2024-06-27T12:17:35Z] INFO: content-type: application/json
[2024-06-27T12:17:35Z] INFO: {"event_type":"provider_verification_failed","client_payload":{"pact_url":"<http://localhost:9292>","sha":"sha","branch":"master","message":"Provider verification failed!"}}
[2024-06-27T12:17:35Z] ERROR: Error executing webhook 1662acf91d16ed1951da4b67a9ea8f37a844bbe3 Errno::ECONNREFUSED - Failed to open TCP connection to localhost:9300 (Connection refused - connect(2) for "localhost" port 9300)
[2024-06-27T12:17:35Z] INFO: Retrying webhook in 10 seconds
I cannot figure out why I am getting ECONNREFUSED, the app is running correctly at port 9300 and I can access the endpoint via both Postman and curl. I'll appreciate any help on this...Matt (pactflow.io / pact-js / pact-go)