I'm seeing some strange behaviour running Pact in ...
# pactflow
c
I'm seeing some strange behaviour running Pact in my CI. Everything was working fine yesterday, but for some reason today the client is not able to fetch the pacts from the broker. It's coming back with a 400 response. Logs in the thread 🧵
Copy code
[04:06:49.444] INFO (1864): pact@11.0.2: Verifying provider
[04:06:49.470] INFO (1864): pact-core@13.13.6: Verifying Pacts.
[04:06:49.473] INFO (1864): pact-core@13.13.6: Verifying Pact Files
2023-05-03T04:06:49.508954Z  INFO ThreadId(03) pact_verifier::pact_broker: Fetching path '/' from pact broker
2023-05-03T04:06:50.589353Z  INFO ThreadId(03) pact_verifier::pact_broker: Fetching path '/pacts/provider/ShippingServiceHttp/for-verification' from pact broker
2023-05-03T04:06:51.211098Z ERROR ThreadId(03) pact_verifier: Failed to load pact - Could not load pacts from the pact broker '************************'
2023-05-03T04:06:51.211158Z  WARN ThreadId(03) pact_matching::metrics: 

Please note:
We are tracking events anonymously to gather important usage statistics like Pact version and operating system. To disable tracking, set the 'PACT_DO_NOT_TRACK' environment variable to 'true'.



Failures:

1) Failed to load pact - Could not load pacts from the pact broker '************************'


There were 1 pact failures

[04:06:51.232] ERROR (1864): pact-core@13.13.6: Verification unsuccessful
FAIL src/shared/pact/__test__/ShippingServiceHttp.producer.pact.test.ts (9.121 s)
  ● Shipping Service HTTP › provides expected responses

    Verfication failed

      at node_modules/@pact-foundation/pact-core/src/verifier/nativeVerifier.ts:52:20
Has something changed which would prevent the pact client from accessing the pacts stored in the pactflow broker?
m
👋
hello!
Mind DMing me the account and/or other redacted values Cody?
c
I thought I could get the redacted values quickly but it's hidden away somewhere, just trying to source them
👍 1
m
np
the account name is probably all I need for now
c
lynk
I think it's
<http://lynk.pactflow.io|lynk.pactflow.io>
m
thx
(I managed to find it by the app name)
If you could set the log level to
DEBUG
you should be able to see the request/response (it might be trace). The response should contain (what I would guess are validation) error messages, that appear to be suppressed.
c
one of the other devs turned on debug and got this. I haven't run myself yet but will try to asap:
Copy code
2023-05-03T04:24:50.589390Z DEBUG ThreadId(16) pact_verifier::pact_broker: error Response for pacts for verification ContentError("Request to pact broker URL '<https://lynk.pactflow.io/pacts/provider/ShippingServiceEvent/for-verification>' failed - HTTP status client error (400 Bad Request) for url (<https://lynk.pactflow.io/pacts/provider/ShippingServiceEvent/for-verification>)")
m
thx. I reckon you might need trace then to see the body that came back.
c
trace like set log level to trace or attach to the running process and trace?
m
log level
c
ok, will give that a crack, cheers
👍 1
m
My guess is that a blank value might be coming through for one of the selector properties
OK, found the log entry (I was an idiot when filtering the logs)
Looks like these args came through:
Copy code
{
  "providerVersionTags": [],
  "includePendingStatus": true,
  "consumerVersionSelectors": [
    {
      "latest": true,
      "branch": "master"
    }
  ],
  "providerVersionBranch": ""
}
The error is that the version branch is empty:
Copy code
"errors": {
    "providerVersionBranch": [
      "when pending or WIP pacts are enabled and there are no tags provided, the provider version branch must not be an empty string, as it is used in the calculations for WIP/pending. A value must be provided (recommended), or it must not be set at all."
    ]
  }
I’m going to raise a defect to report the error, it’s clearly not coming out
c
ah ok, good that you found that because I couldn't get much more out of the trace logs for some reason think ie
oh never mind, I set the log level in the wrong place
😬 1
So for this, are we doing something wrong by not setting the providerVersionBranch? I'm still coming back up to speed on this project (was off it for 8 months) so I'm struggling to remember how we've configured it. Or is this something that the pact client should send differently and we'll need to wait for a patch and upgrade?
m
You should set it, because (as per the error) it’s needed for the pending status calculation (and you have pending set to
true
)
c
ok, cool, I'll have to see what possibly changed on our side because it's happening sort of out of the blue.
🤔 1
m
It’s also the same value used when you publish results, so you should set it, because then PactFlow can track the branches in use (see https://docs.pact.io/getting_started/conceptual_overview#branches--environments and https://docs.pact.io/pact_broker/branches)
I know we’ve recently upgrade our validation with a Ruby 3 upgrade, so this might have actually been a change or bug that was fixed (by accident or on purpose) - but what it’s doing now is highlighting a problem that was possibly masked before
c
I've reset back to a commit that previously ran successfully. This commit fails now
👍 1
so something changed on the pactflow side that causes the failure to happen now. But yeah maybe we've been doing it wrong this whole time but didn't realize it until now
👍 1
m
thanks, I’ll share the feedback. The lead is off at the moment, but I think it was something that was known/watched with a close eye. I think the lack of a visible error message (probably missing in the core) is part of the problem too.
c
yeah fair enough. Thanks for your help Matt party yak
👍 1
m
Welcome. I’ve added a tracking issue. Solving it here will fix the error in most client libraries.
🙌 1