Hi folks. I'm experiencing an issue currently when...
# pact-jvm
a
Hi folks. I'm experiencing an issue currently when trying to publish pacts via gradle. It looks like the request to the broker is dropping auth. If I try and publish to an existing broker that has no auth, it works but when publishing to our new auth’d broker, the request fails. I’m using pact-jvm version 4.2.20 which appears to have fixed some authentication issues but it doesn't appear so in my case. Has anybody else encountered this recently? Any info is appreciated.
I'm using the standard Gradle
pactPublish
step like most folks
Copy code
pact {
    publish {
        pactDirectory = "$rootDir/pacts"
        pactBrokerUrl = "<https://url/sub-path/>"
        pactBrokerUsername = "xxx"
        pactBrokerPassword = "xxx"
    }
}
On inspecting the request it looks like the auth headers are dropped, resulting in a generic error -
<http://au.com|au.com>.dius.pact.core.pactbroker.InvalidNavigationRequest: Failed to fetch the root HAL document
u
Pact-JVM publishes some Pact files to an authenticated broker as part of it's release build, so it definitely works. There must be something else that is the problem.
m
Can you please share any logs Andrew? Might need to set the log level to debug so we can see the req/res from the broker
It looks like you are running the pact broker on a context path - it’s possible that has been misconfigured. What happens is Pact JVM -> request to broker at the root (
/sub-path
in your case). It then sends back a HAL JSON response with links to follow. If the broker doesn’t know it’s running on that path, those links won’t have the prefix and will result in badness
a
Apologies for the delayed response on this one - Unfortunately I am still encountering this issue
We did encounter several subpath issues that were resolved in the most recent version of the OSS Pact Broker instance - I don't believe the subpath is causing issues here, though
We're using
pact-jvm
with
gradle
to build pacts and publish them..from the debugging I've performed, it looks like no matter we try, the
pactBrokerUsername
and
pactBrokerPassword
values are not being sent in the request to the broker
The errors I am seeing are similar to an issue raised in the #C9VPNUJR2 channel by David Van Couvering on Tues 8th March
I've checked network logs and these requests do not have a basic auth'd user attached..however, if I try and publish pacts using a
pact-node
codebase or using the
pact-cli
directly - I can publish pacts with no issue
I've tried multiple ways to get this working with Gradle and passing in system variables, etc - no option seems to persist the auth in the requests
@Matt (pactflow.io / pact-js / pact-go) @uglyog - any ideas?
m
Sorry I’m not sure, I don’t know JVM/Pact JVM well enough to advise. Usually, verbose/debug logging will get you there though