GitHub
06/15/2023, 2:53 PMx):
☑︎ Upgraded to the latest Pact Broker OR
☑︎ Checked the CHANGELOG to see if the issue I am about to raise has been fixed
☐ Created an executable example that demonstrates the issue using either a:
• Dockerfile
• Git repository with a Travis or Appveyor (or similar) build
Software versions
• pact-broker gem version: 2.107.1
• pact-broker docker version: 2.110.0-pactbroker2.107.1
• OS: Mac OS 13.4
• pact broker client details: pact-ruby-standalone 2.0.2
Expected behaviour
Calling ...
SSL_CERT_FILE=self-signed-cert.pem ./pact/bin/pact-broker list-environments --broker-base-url <https://localhost:8443>
...should connect to the broker with a self-signed-certificate, and return the list of environments.
Actual behaviour
The initial handshake with the broker is fine, but the list of returned resource URLs contains the wrong URL (<https://localhost> rather than the expected `https://localhost:8443`), so subsequent calls result in a ECONNREFUSED error:
opening connection to localhost:8443...
opened
starting SSL for localhost:8443...
SSL established, protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384
<- "GET /? HTTP/1.1\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: application/hal+json\r\nUser-Agent: Ruby\r\nHost: localhost:8443\r\n\r\n"
-> "HTTP/1.1 200 OK\r\n"
-> "Server: nginx/1.23.2\r\n"
-> "Date: Thu, 15 Jun 2023 14:27:02 GMT\r\n"
-> "Content-Type: application/hal+json;charset=utf-8\r\n"
-> "Content-Length: 4188\r\n"
-> "Connection: keep-alive\r\n"
-> "Vary: Accept\r\n"
-> "X-Pact-Broker-Version: 2.107.1\r\n"
-> "X-Content-Type-Options: nosniff\r\n"
-> "\r\n"
reading 4188 bytes...
-> "{\"_links\":{\"self\":{\"href\":\"<https://localhost>\",\"title\":\"Index\",\"templated\":false},\"pb:publish-pact\":{\"href\":\"<https://localhost/pacts/provider/{provider}/consumer/{consumer}/version/{consumerApplicationVersion}\>",\"title\":\"Publish a pact\",\"templated\":true},\"pb:publish-contracts\":{\"href\":\"<https://localhost/contracts/publish\>",\"title\":\"Publish contracts\",\"templated\":false},\"pb:latest-pact-versions\":{\"href\":\"<https://localhost/pacts/latest\>",\"title\":\"Latest pact versions\",\"templated\":false},\"pb:tagged-pact-versions\":{\"href\":\"<https://localhost/pacts/provider/{provider}/consumer/{consumer}/tag/{tag}\>",\"title\":\"All versions of a pact for a given consumer, provider and consumer version tag\",\"templated\":false},\"pb:pacticipants\":{\"href\":\"<https://localhost/pacticipants\>",\"title\":\"Pacticipants\",\"templated\":false},\"pb:pacticipant\":{\"href\":\"<https://localhost/pacticipants/{pacticipant}\>",\"title\":\"Fetch pacticipant by name\",\"templated\":true},\"pb:latest-provider-pacts\":{\"href\":\"<https://localhost/pacts/provider/{provider}/latest\>",\"title\":\"Latest pacts by provider\",\"templated\":true},\"pb:latest-provider-pacts-with-tag\":{\"href\":\"<https://localhost/pacts/provider/{provider}/latest/{tag}\>",\"title\":\"Latest pacts for provider with the specified tag\",\"templated\":true},\"pb:provider-pacts-with-tag\":{\"href\":\"<https://localhost/pacts/provider/{provider}/tag/{tag}\>",\"title\":\"All pact versions for the provider with the specified consumer version tag\",\"templated\":true},\"pb:provider-pacts\":{\"href\":\"<https://localhost/pacts/provider/{provider}\>",\"title\":\"All pact versions for the specified provider\",\"templated\":true},\"pb:latest-version\":{\"href\":\"<https://localhost/pacticipants/{pacticipant}/latest-version\>",\"title\":\"Latest pacticipant version\",\"templated\":true},\"pb:latest-tagged-version\":{\"href\":\"<https://localhost/pacticipants/{pacticipant}/latest-version/{tag}\>",\"title\":\"Latest pacticipant version with the specified tag\",\"templated\":true},\"pb:webhooks\":{\"href\":\"<https://localhost/webhooks\>",\"title\":\"Webhooks\",\"templated\":false},\"pb:webhook\":{\"href\":\"<https://localhost/webhooks/{uuid}\>",\"title\":\"Webhook\",\"templated\":true},\"pb:integrations\":{\"href\":\"<https://localhost/integrations\>",\"title\":\"Integrations\",\"templated\":false},\"pb:pacticipant-version-tag\":{\"href\":\"<https://localhost/pacticipants/{pacticipant}/versions/{version}/tags/{tag}\>",\"title\":\"Get, create or delete a tag for a pacticipant version\",\"templated\":true},\"pb:pacticipant-branch-version\":{\"href\":\"<https://localhost/pacticipants/{pacticipant}/branches/{branch}/versions/{version}\>",\"title\":\"Get or add/create a pacticipant version for a branch\",\"templated\":true},\"pb:pacticipant-version\":{\"href\":\"<https://localhost/pacticipants/{pacticipant}/versions/{version}\>",\"title\":\"Get, create or delete a pacticipant version\",\"templated\":true},\"pb:metrics\":{\"href\":\"<https://localhost/metrics\>",\"title\":\"Get Pact Broker metrics\"},\"pb:can-i-deploy-pacticipant-version-to-tag\":{\"href\":\"<https://localhost/can-i-deploy?pacticipant={pacticipant}&version={version}&to={tag}\>",\"title\":\"Determine if an application version can be safely deployed to an environment identified by the given tag\",\"templated\":true},\"pb:can-i-deploy-pacticipant-version-to-environment\":{\"href\":\"<https://localhost/can-i-deploy?pacticipant={pacticipant}&version={version}&environment={environment}\>",\"title\":\"Determine if an application version can be safely deployed to an environment\",\"templated\":true},\"pb:provider-pacts-for-verification\":{\"href\":\"<https://localhost/pacts/provider/{provider}/for-verification\>",\"title\":\"Pact versions to be verified for the specified provider\",\"templated\":true},\"beta:provider-pacts-for-verification\":{\"name\":\"beta\",\"href\":\"<https://localhost/pacts/provider/{provider}/for-verification\>",\"title\":\"DEPRECATED - please use pb:provider-pacts-for-verification\",\"templated\":true},\"curies\":[{\"name\":\"pb\",\"href\":\"<https://localhost/doc/{rel}?context=index\>",\"templated\":true},{\"name\":\"beta\",\"href\":\"<https://localhost/doc/{rel}?context=index\>",\"templated\":true}],\"pb:environments\":{\"title\":\"Environments\",\"href\":\"<https://localhost/environments\>",\"templated\":false},\"pb:environment\":{\"title\":\"Environment\",\"href\":\"<https://localhost/environments/{uuid}\>",\"templated\":true}}}"
read 4188 bytes
Conn keep-alive
opening connection to localhost:443...
ERROR: Error making request - Errno::ECONNREFUSED Failed to open TCP connection to localhost:443 (Connection refused - connect(2) for "localhost" port 443) /projects/provider-exemplar-nodejs/pact/lib/vendor/ruby/3.2.0/gems/pact_broker-client-1.66.1/lib/pact_broker/client/hal/http_client.rb:79:in `block in perform_request', attempt 1 of 5
Steps to reproduce
Use this docker-compose config:
version: "3"
services:
postgres:
image: postgres
healthcheck:
test: psql postgres --command "select 1" -U postgres
volumes:
- postgres-volume:/var/lib/postgresql/data
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: postgres
pact-broker:
image: pactfoundation/pact-broker:2.110.0-pactbroker2.107.1
ports:
- "9292:9292"
depends_on:
- postgres
environment:
PACT_BROKER_PORT: "9292"
PACT_BROKER_DATABASE_URL: "<postgres://postgres:password@postgres/postgres>"
PACT_BROKER_LOG_LEVEL: DEBUG
PACT_BROKER_DATABASE_CONNECT_MAX_RETRIES: "5"
PACT_BROKER_BASE_URLS: "<https://localhost:8443> <https://host.docker.internal:8443>"
PACT_BROKER_HTTP_DEBUG_LOGGING_ENABLED: "true"
ngnix:
image: nginx:alpine
depends_on:
- pact-broker
volumes:
- ./ssl/nginx.conf:/etc/nginx/conf.d/default.conf:ro
- ./ssl:/etc/nginx/ssl
ports:
- "8443:443"
- "80:80"
volumes:
postgres-volume:
With this nginx config (held in ./ssl/ directory, al…
pact-foundation/pact_broker