New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Got Net::HTTPFatalError: 503 "Service Unavailable" when provider verify the pact #315
Comments
If you could please set logging of the test to You should also review the logs from your provider to see what might be going on. It also looks like you're verifying against a deployed environment. Whilst this is supported, it's not recommended (harder to get fine grained control over the test) and as we're seeing here, harder to get logging information as to why the service is erroring out. |
Thanks for replying. Yes, we are verifying against a deployed environment for a demo because it's kind hard to verify our app in local now. |
Is that a Pact method? To enable better logging, I believe these are the parameters to do so: https://github.com/pact-foundation/pact-python/blob/master/pact/verifier.py#L99-L100 Glad to hear you're moving ahead, but I'd still love to see you getting the Python library up and running as in the long term it should be better for you. |
Thanks again. After walking through the source code and debugging I think I have located the problem. Mostly because the pact binaries combined in pact-python is incompatible with my local dev env |
Same issue when I run it in my gitlab pipeline with pact-provider-verifier(md5: facd78d6de9c3eee604a60d804f13454 ) integrated in pact-python. I download the pact standalone with version 1.88.83. The pact-provider-verifier won't work too with same 503 error. How about update the pact binaries integrated in pact-python to the latest? |
You may wish to try again with pact-python 2.x - it included the latest pact-ruby-standalone which has an updated ruby runtime. If not, and you can provide a reproducible example. I have a GitLab account and a self hosted instance in my homelab so can help out. Will close this issue for now, feel free to reply and we can reopen if you wish |
I try to verify the pact through the code below
but always got "Net::HTTPFatalError: 503" error as below and I check my provider api logs. No call happened.
And I can verify it by the pact-provider-verifier CLI tool with the same config.
Anything went wrong ?
issue code:
PACT_BROKER_URL = "**********"
PACT_BROKER_TOKEN = "***********"
PROVIDER_HOST = "*********.com"
PROVIDER_URL = f"https://{PROVIDER_HOST}"
@pytest.fixture
def broker_opts():
return {
"broker_url": PACT_BROKER_URL,
"broker_token": PACT_BROKER_TOKEN,
"publish_version": "3",
"publish_verification_results": True,
}
def test_user_service_provider_against_broker(broker_opts):
verifier = Verifier(provider="partner-content", provider_base_url=PROVIDER_URL)
success, logs = verifier.verify_with_broker(
**broker_opts,
# verbose=True,
enable_pending=False
)
error log:
`
E assert 1 == 0
tests/provider/test_provider.py:61: AssertionError
------------------------------------------------------------------------------------------------------------------ Captured stdout call ------------------------------------------------------------------------------------------------------------------
INFO: Fetching pacts for partner-content from *********** with the selection criteria:
INFO: Reading pact at ******
WARN: Please note: we are tracking events anonymously to gather important usage statistics like Pact-Ruby version
and operating system. To disable tracking, set the 'PACT_DO_NOT_TRACK' environment
variable to 'true'.
DEBUG: The pact at ******* is being verified because the pact content belongs to the consumer version matching the following criterion:
* latest version of partner-front-end that has a pact with partner-content (1.0.0)
Verifying a pact between partner-front-end and partner-content
Given fetch correct facility sections
a request to fetch the correct section
with GET /fresa/extranet/content/facilities/sections/get?hotel_id=2556459&ses=0ebee5e52eee39ee1ebef0b79252042d&lang=en
returns a response which
WARN: Skipping set up for provider state 'fetch correct facility sections' for consumer 'partner-front-end' as there is no --provider-states-setup-url specified.
has status code 200 (FAILED - 1)
WARN: Skipping set up for provider state 'fetch correct facility sections' for consumer 'partner-front-end' as there is no --provider-states-setup-url specified.
has a matching body (FAILED - 2)
Failures:
Verifying a pact between partner-front-end and partner-content Given fetch correct facility sections a request to fetch the correct section with GET /fresa/extranet/content/facilities/sections/get?hotel_id=2556459&ses=0ebee5e52eee39ee1ebef0b79252042d&lang=en returns a response which has status code 200
Failure/Error: replay_interaction interaction, options[:request_customizer]
Net::HTTPFatalError:
503 "Service Unavailable"
/Users/szhu2/Projects/main/venv/lib/python3.9/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http/response.rb:119:in
error!' /Users/szhu2/Projects/main/venv/lib/python3.9/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http/response.rb:128:in
value'/Users/szhu2/Projects/main/venv/lib/python3.9/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:915:in
connect' /Users/szhu2/Projects/main/venv/lib/python3.9/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:863:in
do_start'/Users/szhu2/Projects/main/venv/lib/python3.9/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:858:in `start'
Verifying a pact between partner-front-end and partner-content Given fetch correct facility sections a request to fetch the correct section with GET /fresa/extranet/content/facilities/sections/get?hotel_id=2556459&ses=0ebee5e52eee39ee1ebef0b79252042d&lang=en returns a response which has a matching body
Failure/Error: replay_interaction interaction, options[:request_customizer]
Net::HTTPFatalError:
503 "Service Unavailable"
/Users/szhu2/Projects/main/venv/lib/python3.9/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http/response.rb:119:in
error!' /Users/szhu2/Projects/main/venv/lib/python3.9/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http/response.rb:128:in
value'/Users/szhu2/Projects/main/venv/lib/python3.9/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:915:in
connect' /Users/szhu2/Projects/main/venv/lib/python3.9/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:863:in
do_start'/Users/szhu2/Projects/main/venv/lib/python3.9/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:858:in `start'
1 interaction, 1 failure
`
The text was updated successfully, but these errors were encountered: