hey all, someone already face this error before: ...
# pact-broker
g
hey all, someone already face this error before:
Copy code
Pact contract publishing failed:  Error: Pact publication failed with non-zero exit code. Full output was:
<internal:gem_prelude>:4:in `require': cannot load such file -- rubygems.rb (LoadError)
        from <internal:gem_prelude>:4:in `<internal:gem_prelude>'
what i did: • created a
publish.js
• run the
publish.js
to publish the pacts into pactflow
m
You're running onto the notorious windows long path issue. You'll need to move closer to C:
Or use a different publishing mechanism
(e.g docker or the cli)
Howtocli
g
so basically i have this options:
Copy code
pact-broker publish pacts/ --consumer-app-version 1.0.0 --branch main --broker-base-url=<URL> --broker-token=<TOKEN>
to use this i need to install the
pact-broker
?
m
Yes. Or you can continue to use it as is, but just move the working directly closer to
c:\
. There is a 255 character limit in path names, and you’re chewing up a bunch there 😉
g
thanks @Matt (pactflow.io / pact-js / pact-go) but i don't think is a good approach, because the
publish.js
point to pacts folder right? so the pactFilesOrDirs will be long as well... for example, my plan is to run locally and also at github actions and to do it manage the path will be kind confusing to other members of my team! i didn't find an option to use pact-broker in the docs, i mean, there is no setup to use it...
I can run a provider without a broker, correct? how can i do it? i have to grab the files from pacts folder?!
also i have this option >> https://hub.docker.com/r/pactfoundation/pact-cli correct?!
m
but i don’t think is a good approach, because the
publish.js
point to pacts folder right? so the pactFilesOrDirs will be long as well...
it’s not the file path of the pacts to publish, it’s actually an underlying Ruby library that exceeds the length.
Once volume mounted into Docker the long path issue becomes irrelevant
I can run a provider without a broker, correct? how can i do it? i have to grab the files from pacts folder?!
Yes you can. If you’re talking about provider verification without a broker, you would specify the URL to a pact file in the verification process, instead of the broker.
also i have this option >> https://hub.docker.com/r/pactfoundation/pact-cli
to do what sorry - publish pacts? Yes You seem to be a little confused by some of the concepts here. I really recommend you run some of the workshops and come back once you’ve done that.
g
right @Matt (pactflow.io / pact-js / pact-go) yes i was kind confusing, but i have more understanding right now! Anyway I managed to publish the pacts and I'm getting the passed result when i run the Pact Verification step provider file:
Copy code
import { Verifier } from '@pact-foundation/pact';

describe('Pact Verification', () => {
  jest.setTimeout(50000);
  test('validates the expectations of Matching Service', () => {
    return new Verifier({
      providerBaseUrl:
        'providerBaseUrl',
      publishVerificationResult: true,
      providerVersion: '2.0.0',
    })
      .verifyProvider()
      .then((output) => {
        console.log('Pact Verification Complete!');
        console.log(output);
      });
  });
});
result
also the result at pactflow
providerBaseUrl
means Running API provider host endpoint. it means that i can use this API resource from pactflow?
b
@Gustavo Souza no….
the providerBaseUrl is the URL of the locally running provider that you are testing your contracts against.
👍 1
m
also the result at pactflow
that result is “unverified” - this means the verification either didn’t run properly, didn’t publish or both
g
about the “not verified” result I really don't know, maybe it's related to not being able to perform provider verification
@Matt (pactflow.io / pact-js / pact-go) here is the publish step
m
There are two types of publishing: 1. Publishing your pact files (the contract) 2. Publishing the verification results (the provider has verified one or more contracts, and the results are published back to a Pact Broker)
The contsumer publishing is working, because you can see the contract in PactFlow
The verification process is not
The reason looks simple to me - you haven’t specified the name of the provider to verify
so when it goes to PactFlow, it doesn’t know which application to find contracts for