Hi, I deployed pact-broker in EC2 and was configur...
# pact-broker
m
Hi, I deployed pact-broker in EC2 and was configured to Cloudfront. I am able to access the UI using Cloudfront URL. But while doing the publish, the broker client is looking for localhost:443 URL. We are passing proper URL and Credentials.
Copy code
ERROR: Error making request - Errno::ECONNREFUSED Failed to open TCP connection to localhost:443 (Connection refused - connect(2) for "localhost" port 443) /node_modules/@pact-foundation/pact-core/standalone/darwin-arm64-2.0.2/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 5 of 5
/node_modules/@pact-foundation/pact-core/standalone/darwin-arm64-2.0.2/pact/lib/ruby/lib/ruby/3.2.0/net/http.rb:1271:in `initialize': Failed to open TCP connection to localhost:443 (Connection refused - connect(2) for "localhost" port 443) (Errno::ECONNREFUSED)
NPM Script
Copy code
"scripts": {
    "publish-pact-ec2": "pact-broker publish ./pacts --consumer-app-version 1.0 --broker-base-url 'https://*************.<http://cloudfront.net|cloudfront.net>' --broker-username ******* --broker-password ********",
    "test-provider": "nyc --reporter=text-summary mocha -t 30000 tests/provider.spec.js"
  },
m
Try adding --verbose and see what it says
m
Copy code
{
  "_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
    }
  }
}
m
Yep. Your pact broker is incorrectly setup
I thinks the host is localhost