Hi, We are having some intermittent issues when pu...
# pact-jvm
j
Hi, We are having some intermittent issues when publishing consumer contracts. We are getting the below error in CI:
Copy code
Request to path '**********************************************contracts/publish' failed with HTTP response 500
JSON Response:
{
  "error": {
    "message": "source sequence is illegal/malformed utf-8",
    "reference": "YeJQYFKhHV"
  }
}
I think its related to use using the
.matchQuery("version", "1.0.0")
as the value become encoded and then shows as
"1\uB0D60\uB3DA0"
in the contract. We also have a header using
.matchHeader("header", ".*")
which becomes encoded itself and then appears in the broker as
"屏啾"
. We are publishing using the pact gradle plugin and the command
./gradlew pactPublish
. Weirdly though, the pipeline failed twice to publish and then with a retry for a third time it passed. I have suggested to the team to use
encodedQuery
and to change the header value as its not important for the service we are using but I’m curious to know why it would fail to publish but then eventually pass with no changes, is there some sort of race condition there?
r
With regular expressions,
.
can be any byte value, not necessarily valid UTF-8 code points.
When using those functions, always give an example value (third parameter). That will be written into the Pact file, and you won't have this issue.