Hi, I am having an issue trying to use `failIfNoPa...
# pact-js
n
Hi, I am having an issue trying to use
failIfNoPactsFound
flag on the provider side When it is set to true I get
Copy code
Failures:

1) Failed to load pact - No pacts found matching the given consumer version selectors in pact broker '

// {"name":"Error","message":"Verfication failed","stack":"Error: Verfication failed\n    at /....
and when it is set to false I get
Copy code
Failures:

1) Failed to load pact - No pacts found matching the given consumer version selectors in pact broker '

// {"name":"Error","message":"Verfication failed","stack":"Error: Verfication failed\n    at /....
It doesn't seem to for for me as soon as I start using
consumerVersionSelectors.deployedOrReleased
. If I do not set
deployedOrReleased
at all,
failIfNoPactsFound
works fine. Same happens when using
mainBranch
flag
🙌 1
m
Mind sharing the logs? at DEBUG level? It could be a bug somewhere
👍 1
n
Copy code
2023-12-20T12:00:30.711417Z DEBUG ThreadId(02) pact_verifier::pact_broker: Sending JSON to https://<REDACTED>/pacts/provider/<PROVIDER_NAME>/for-verification using POST: {"includePendingStatus":false,"consumerVersionSelectors":[{"latest":true,"mainBranch":true,"branch":"mainx"}],"providerVersionBranch":"nico-test"}
2023-12-20T12:00:30.711451Z DEBUG ThreadId(02) hyper::client::pool: reuse idle connection for ("https", <REDACTED>)
// ...
2023-12-20T12:00:31.050167Z  INFO ThreadId(02) pact_verifier::pact_broker: error response for pacts for verification: failed validation - ["consumerVersionSelectors: cannot specify mainBranch=true with any other criteria apart from consumer (at index 0)"] 
2023-12-20T12:00:31.050498Z ERROR ThreadId(02) pact_verifier: No pacts found matching the given consumer version selectors in pact broker 'https://<REDACTED>': failed validation - ["consumerVersionSelectors: cannot specify mainBranch=true with any other criteria apart from consumer (at index 0)"]
Copy code
2023-12-20T12:07:47.808284Z DEBUG ThreadId(02) pact_verifier::pact_broker: Sending JSON to <REDACTED>/pacts/provider/<PROVIDER_NAME>/for-verification using POST: {"includePendingStatus":false,"consumerVersionSelectors":[{"deployedOrReleased":true,"branch":"mainx"}],"providerVersionBranch":"nico-test"}
["consumerVersionSelectors: cannot specify the field branch with the field deployedOrReleased (at index 0)"]
@Matt (pactflow.io / pact-js / pact-go) it is basically telling me that I cannot mix certain props
Now I am looking at it better, the info was right there with logLvel "info
Copy code
2023-12-20T12:17:32.559427Z  INFO ThreadId(11) pact_verifier::pact_broker: error response for pacts for verification: failed validation - ["consumerVersionSelectors: cannot specify the fields branch/latest with the field deployedOrReleased (at index 0)"] 
2023-12-20T12:17:32.561122Z ERROR ThreadId(11) pact_verifier: No pacts found matching the given consumer version selectors in pact broker '<https://skyai.pactflow.io>': failed validation - ["consumerVersionSelectors: cannot specify the fields branch/latest with the field deployedOrReleased (at index 0)"]
2023-12-20T12:17:32.562776Z ERROR ThreadId(11) pact_verifier: Failed to load pact - No pacts found matching the given consumer version selectors in pact broker '<REDACTED>'
2023-12-20T12:17:32.563719Z  WARN ThreadId(11) pact_matching::metrics:
Copy code
2023-12-20T12:19:00.414088Z  INFO ThreadId(11) pact_verifier::pact_broker: error response for pacts for verification: failed validation - ["consumerVersionSelectors: cannot specify the field branch with the field deployedOrReleased (at index 0)"] 
2023-12-20T12:19:00.414601Z ERROR ThreadId(11) pact_verifier: No pacts found matching the given consumer version selectors in pact broker '<REDACTED>': failed validation - ["consumerVersionSelectors: cannot specify the field branch with the field deployedOrReleased (at index 0)"]
👍 1
m
can you please show me how you’re sending them in TS? I think you just need to separate them into different selectors (they are all in the same object / position 0 in the array of selectors)
n
Yes, they were altogether
m
yep, separate them into two (or more):
[{deployedOrReleased: true}, {mainBranch: true}, ...]
1
There is a bug though, that error should probably propagate to the user better. Mind raising a bug on Pact JS for me please? We can get it sorted (it’s upstream, but I can move it)
n
Is it in pact-js or pact-js-core?
m
It’s actually in the rust core (https://github.com/pact-foundation/pact-reference). You can raise it there also if you like, and I can embellish it as needed
🙌 1
thanks
n
I have just shape it a little more, but it still needs to be polished
🙏 1
m
Thanks for that!