Hello, Hoping you can help again :). Our Pact Brok...
# pact-broker
j
Hello, Hoping you can help again :). Our Pact Broker instance is returning a "failed to open TCP connection" "(Blocking operation timed out)" to any CLI command. We can browse to and log in to our Pact Broker instance OK and can upload Pacts via Postman and verify using Pact.Net. Steps to replicate: Download and extract latest pact-ruby-standalone Windows x86_64 from https://github.com/pact-foundation/pact-ruby-standalone/releases Open CMD as admin and run: pact-broker.bat list_latest_pact_versions -b https://<pactbrokerurl>.azurewebsites.net:9292 -u <username> -p <password> Troubleshooting - Logging is set to debug. There are no new traces at the time of executing the CLI command. This would suggest the command isn't reaching the pact broker. There have been no additional configuration changes since we last asked for help. - Our infra team confirmed yesterday the firewall is configured to allow traffic to/from the pact broker. Do you have any ideas? Without the port appended to it, the response received is "OpenTimeout". Appreciate any assistance you can help us with again. Thank you
y
Has it ever worked from the pact cli? Are you providing a path to your cert file? https://github.com/pact-foundation/pact-ruby-standalone?tab=readme-ov-file#ssl
👍 1
j
Hi Yousaf, Thanks for the reply :) Yep, it worked last year. Will give that a try thank you
Hi Yousaf, Thanks for your help again. So our infra team cannot provide a path to the certs file for security reasons. They have suggested pointing CLI command at the default domain and have confirmed traffic is allowed to/from the pact broker on that port. The CLI returns Net::OpenTimeout Any ideas? Thanks, James
y
I’d go back to looking at what it was set up like when it was working, and what has changed since then. If its just the version of the pact cli, I would revert back to an older version you know worked, as see if that still does? With Postman you can check if its configured with SSL cert verification set to off. You can curl the broker too, as it exposes an api. If you can’t make a request without provide a path to SSL_CERT_FILE or you have to use
--insecure
in the request, then you will most likely need to either disable ssl
PACT_DISABLE_SSL_VERIFICATION=true
or provide a path to your cert file.
👍 1
j
Thank you, Yousaf. Will keep you in the loop. James
Hi Yousaf, Thanks for your suggestions again. Unfortunately, the last known working pact cli version (pact-2.0.10-windows-x64_64) and pact 2.4.0 (windows-x86) does not work. Using Postman we can make requests successfully with SSL cert verification on and off. I've also downloaded the assets manually from github too. I've also disabled SSL verification using the command provided and "PACT_BROKER_DISABLE_SSL_VERIFICATION=true", which gave the same response. I've replicated the issue using docker and running cmd as admin gives the following response. What does this suggest to you? Thanks for your help again we appreciate it!
Copy code
t_broker/client/hal/http_client.rb:86:in `block in perform_request', attempt 1 of 3
Error making request - Net::OpenTimeout Net::OpenTimeout /usr/lib/ruby/gems/3.2.0/gems/pact_broker-client-1.75.1/lib/pact_broker/client/hal/http_client.rb:86:in `block in perform_request', attempt 2 of 3
Error making request - Net::OpenTimeout Net::OpenTimeout /usr/lib/ruby/gems/3.2.0/gems/pact_broker-client-1.75.1/lib/pact_broker/client/hal/http_client.rb:86:in `block in perform_request', attempt 3 of 3
Error retrieving matrix. Net::OpenTimeout - Net::OpenTimeout
/usr/lib/ruby/3.2.0/net/protocol.rb:43:in `ssl_socket_connect'
/usr/lib/ruby/gems/3.2.0/gems/net-http-0.4.1/lib/net/http.rb:1674:in `connect'
/usr/lib/ruby/gems/3.2.0/gems/net-http-0.4.1/lib/net/http.rb:1580:in `do_start'
/usr/lib/ruby/gems/3.2.0/gems/net-http-0.4.1/lib/net/http.rb:1569:in `start'
/usr/lib/ruby/gems/3.2.0/gems/pact_broker-client-1.75.1/lib/pact_broker/client/hal/http_client.rb:86:in `block in perform_request'
/usr/lib/ruby/gems/3.2.0/gems/pact_broker-client-1.75.1/lib/pact_broker/client/hal/http_client.rb:100:in `until_truthy_or_max_times'
/usr/lib/ruby/gems/3.2.0/gems/pact_broker-client-1.75.1/lib/pact_broker/client/hal/http_client.rb:65:in `perform_request'
/usr/lib/ruby/gems/3.2.0/gems/pact_broker-client-1.75.1/lib/pact_broker/client/hal/http_client.rb:25:in `get'
/usr/lib/ruby/gems/3.2.0/gems/pact_broker-client-1.75.1/lib/pact_broker/client/hal/link.rb:41:in `get'
/usr/lib/ruby/gems/3.2.0/gems/pact_broker-client-1.75.1/lib/pact_broker/client/hal/link.rb:45:in `get!'
/usr/lib/ruby/gems/3.2.0/gems/pact_broker-client-1.75.1/lib/pact_broker/client/matrix/query.rb:11:in `call'
/usr/lib/ruby/gems/3.2.0/gems/pact_broker-client-1.75.1/lib/pact_broker/client/base_command.rb:13:in `call'
/usr/lib/ruby/gems/3.2.0/gems/pact_broker-client-1.75.1/lib/pact_broker/client/can_i_deploy.rb:107:in `block in fetch_matrix'
/usr/lib/ruby/gems/3.2.0/gems/pact_broker-client-1.75.1/lib/pact_broker/client/retry.rb:22:in `while_error'
/usr/lib/ruby/gems/3.2.0/gems/pact_broker-client-1.75.1/lib/pact_broker/client/can_i_deploy.rb:107:in `fetch_matrix'
/usr/lib/ruby/gems/3.2.0/gems/pact_broker-client-1.75.1/lib/pact_broker/client/can_i_deploy.rb:111:in `fetch_matrix_with_retries'
/usr/lib/ruby/gems/3.2.0/gems/pact_broker-client-1.75.1/lib/pact_broker/client/can_i_deploy.rb:34:in `call'
/usr/lib/ruby/gems/3.2.0/gems/pact_broker-client-1.75.1/lib/pact_broker/client/can_i_deploy.rb:23:in `call'
/usr/lib/ruby/gems/3.2.0/gems/pact_broker-client-1.75.1/lib/pact_broker/client/cli/matrix_commands.rb:41:in `can_i_deploy'
/usr/lib/ruby/gems/3.2.0/gems/thor-1.3.0/lib/thor/command.rb:28:in `run'
/usr/lib/ruby/gems/3.2.0/gems/thor-1.3.0/lib/thor/invocation.rb:127:in `invoke_command'
/usr/lib/ruby/gems/3.2.0/gems/thor-1.3.0/lib/thor.rb:527:in `dispatch'
/usr/lib/ruby/gems/3.2.0/gems/thor-1.3.0/lib/thor/base.rb:584:in `start'
/usr/lib/ruby/gems/3.2.0/gems/pact_broker-client-1.75.1/lib/pact_broker/client/cli/custom_thor.rb:34:in `start'
/usr/lib/ruby/gems/3.2.0/gems/pact_broker-client-1.75.1/bin/pact-broker:10:in `<top (required)>'
/usr/bin/pact-broker:25:in `load'
/usr/bin/pact-broker:25:in `<main>'
Hi Yousaf and team, Any ideas, please? We noticed the response is identical to https://stackoverflow.com/questions/42036133/ruby-netopentimeout-execution-expired. Does this help? Any additional pointers would be much appreciated. Thank you
y
There are three ways to use the broker client • Standalone • Docker • RubyGems I would try to use each of those and attempt to • Connect to a hosted PactFlow broker (test SSL against a properly signed cert) • Connect to a locally running Pact Broker without HTTPS • Connect to a locally running Pact Broker with HTTPS (you can use the SSL example in the pact-broker-docker repo) • Connect to your own broker Each of the distribution methods should work with each of the possible configuration methods. I am confused by your reporting > Unfortunately, the last known working pact cli version (pact-2.0.10-windows-x64_64) and pact 2.4.0 (windows-x86) does not work. > I’ve replicated the issue using docker and running cmd as admin gives the following response. If the last working version (for you) of the CLI was 2.0.10, which now doesn’t work today, and it also doesn’t work in Docker, then I would expect the issue not to be on Pact’s side, but instead with your network and/or broker setup
👍 1
j
Thanks for the reply Yousaf and the suggestions. Will work through them. James
y
No worries chap, fingers crossed fingerscrossed
😀 1
j
Yousaf, Quick question - the infra team would like to know what port should be opened for this to work? Thank you, James
y
From the client side. if your connecting to a broker via HTTPS and you don’t provide a port, it will use 443, if you are conecting via HTTP and don’t provide a port it’ll use port 80. If you are provided a port for your broker, are its not one of the standard, you’ll need to provide it
👍 1
j
Thank you!
Hey Yousaf, Good news - We resolved the issue. It was an environmental issue and your feedback / SSL pointers helped us to identify and solve the problem so thank you again! James
🙌 1
y
pleasure dude, glad its all sorted. might be worth documenting some of this for others in your team/org who might get stuck int future. all the best James
💯 1
j
Well said and very good shout on documentation. All the best Yousaf!