michael osarumwense
11/29/2022, 10:55 PM22:42:05.290] INFO (26840): pact@10.1.4: Verifying provider
[22:42:05.297] INFO (26840): pact-core@13.12.2: Verifying Pacts.
RUNS __tests__/provider.js
RUNS __tests__/provider.js
2022-11-29T22:42:11.622800Z ERROR ThreadId(12) pact_verifier: Failed to load pact - Failed to load pact '<https://cloudmargin.pactflow.io/pacts/provider/Provider-Backend/consumer/Consumer-Personal-Media/latest>' - Request failed with status - 401 Unauthorized
2022-11-29T22:42:11.624057Z ERROR ThreadId(12) pact_verifier: Failed to load pact - Could not load pacts from the pact broker '<https://cloudmargin.pactflow.io>'
2022-11-29T22:42:11.625595Z WARN ThreadId(12) 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 - Failed to load pact '<https://cloudmargin.pactflow.io/pacts/provider/Provider-Backend/consumer/Consumer-Personal-Media/latest>' - Request failed with status - 401 Unauthorized
2) Failed to load pact - Could not load pacts from the pact broker '<https://cloudmargin.pactflow.io>'
FAIL __tests__/provider.js (7.98 s)
Backend Personal Media verification
× validates the expectations of personal media (6414 ms)
● Backend Personal Media verification › validates the expectations of personal media
Verfication failed
at node_modules/@pact-foundation/pact-core/src/verifier/nativeVerifier.ts:50:20Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
michael osarumwense
11/29/2022, 11:17 PMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
michael osarumwense
11/29/2022, 11:31 PMMatt (pactflow.io / pact-js / pact-go)
michael osarumwense
11/29/2022, 11:31 PMmichael osarumwense
11/29/2022, 11:33 PMMatt (pactflow.io / pact-js / pact-go)
13 if you print out `console.log(Token ${process.env.PACT_BROKER_TOKEN})` does the correct token value print out?Matt (pactflow.io / pact-js / pact-go)
403 if it were the case, but just to be sure)
2. Set log level to debug and see what the verifier is sending to the Brokermichael osarumwense
11/29/2022, 11:49 PM> web-server@1.0.0 test:provider
> rimraf pacts && jest __tests__/ --runInBand --force-exit
RUNS __tests__/provider.js
2022-11-29T23:44:01.756550Z DEBUG ThreadId(01) pact_ffi::verifier: pact_ffi::verifier::pactffi_verifier_new_for_application FFI function invoked
2022-11-29T23:44:01.757169Z DEBUG ThreadId(01) pact_ffi::verifier: pact_ffi::verifier::pactffi_verifier_set_provider_info FFI function invoked
2022-11-29T23:44:01.757509Z DEBUG ThreadId(01) pact_ffi::verifier: pact_ffi::verifier::pactffi_verifier_set_provider_state FFI function invoked
2022-11-29T23:44:01.757666Z DEBUG ThreadId(01) pact_ffi::verifier: pact_ffi::verifier::pactffi_verifier_set_verification_options FFI function invoked
2022-11-29T23:44:01.757832Z DEBUG ThreadId(01) pact_ffi::verifier: pact_ffi::verifier::pactffi_verifier_set_publish_options FFI function invoked
2022-11-29T23:44:01.759765Z DEBUG ThreadId(01) pact_ffi::verifier: pact_ffi::verifier::pactffi_verifier_url_source FFI function invoked
2022-11-29T23:44:01.760059Z DEBUG ThreadId(01) pact_ffi::verifier: pact_ffi::verifier::pactffi_verifier_broker_source_with_selectors FFI function invoked
2022-11-29T23:44:01.760329Z DEBUG ThreadId(02) pact_ffi::verifier: pact_ffi::verifier::pactffi_verifier_execute FFI function invoked
2022-11-29T23:44:01.760466Z DEBUG ThreadId(02) pact_ffi::verifier::handle: Pact source to verify = URL(<https://cloudmargin.pactflow.io/pacts/provider/Provide>
RUNS __tests__/provider.js
2022-11-29T23:44:01.761410Z DEBUG ThreadId(02) pact_ffi::verifier::handle: Pact source to verify = PactBrokerWithDynamicConfiguration(<https://cloudmargin.pactflow.io>, provider_name='Provider-Backend', enable_pending=false, include_wip_since=None, provider_tags=["main"], provider_branch=Some(""), consumer_version_selectors='[ConsumerVersionSelector { consumer: None, tag: Some("main"), fallback_tag: None, latest: Some(true), deployed_or_released: None, deployed: None, released: None, environment: None, main_branch: None, branch: None, matching_branch: None }], auth=User(<mailto:michael.oosarumwense@gmail.com|michael.oosarumwense@gmail.com>, Mich***********)')
2022-11-29T23:44:01.766107Z DEBUG ThreadId(02) pact_plugin_driver::catalogue_manager: Updated catalogue entries:
core/content-generator/binary
core/content-generator/json
core/content-matcher/json
core/content-matcher/multipart-form-data
core/content-matcher/text
core/content-matcher/xml
2022-11-29T23:44:01.767351Z DEBUG ThreadId(02) pact_plugin_driver::catalogue_manager: Updated catalogue entries:
core/matcher/v1-equality
core/matcher/v2-max-type
core/matcher/v2-min-type
core/matcher/v2-minmax-type
core/matcher/v2-regex
core/matcher/v2-type
core/matcher/v3-content-type
core/matcher/v3-date
core/matcher/v3-datetime
core/matcher/v3-decimal-type
core/matcher/v3-includes
core/matcher/v3-integer-type
core/matcher/v3-null
core/matcher/v3-number-type
core/matcher/v3-time
core/matcher/v4-array-contains
core/matcher/v4-equals-ignore-order
core/matcher/v4-max-equals-ignore-order
core/matcher/v4-min-equals-ignore-order
core/matcher/v4-minmax-equals-ignore-order
core/matcher/v4-not-empty
core/matcher/v4-semver
2022-11-29T23:44:01.780808Z DEBUG tokio-runtime-worker hyper::client::connect::dns: resolving host="<http://cloudmargin.pactflow.io|cloudmargin.pactflow.io>"
RUNS __tests__/provider.js
2022-11-29T23:44:02.058380Z DEBUG reqwest-internal-sync-runtime hyper::client::connect::http: connected to 3.105.11.81:443
[23:44:01.746] INFO (27772): pact@10.1.4: Verifying provider
[23:44:01.757] DEBUG (27772): pact-core@13.12.2: the optional ffi function 'pactffiVerifierSetFilterInfo' was not executed as it had non-fatal validation errors: None of PACT_DESCRIPTION, PACT_PROVIDER_STATE or PACT_PROVIDER_NO_STATE were set in the environment
[23:44:01.753] INFO (27772): pact-core@13.12.2: Verifying Pacts.
[23:44:01.754] INFO (27772): pact-core@13.12.2: Verifying Pact Files
[23:44:01.754] DEBUG (27772): pact-core@13.12.2: Initalising native core at log level 'DEBUG'
[23:44:01.757] DEBUG (27772): pact-core@13.12.2: the optional ffi function 'pactffiVerifierSetConsumerFilters' was not executed as it had non-fatal validation errors: Either no consumerFilters option provided, or the array was empty
[23:44:01.758] DEBUG (27772): pact-core@13.12.2: the optional ffi function 'pactffiVerifierSetFailIfNoPactsFound' was not executed as it had non-fatal validation errors: No failIfNoPactsFound option provided
[23:44:01.758] DEBUG (27772): pact-core@13.12.2: the optional ffi function 'pactffiVerifierAddCustomHeader' was not executed as it had non-fatal validation errors: No customProviderHeaders option provided
[23:44:01.758] DEBUG (27772): pact-core@13.12.2: checking source type of given pactUrl: <https://cloudmargin.pactflow.io/pacts/provider/Provider-Backend/consumer/Consumer-Personal-Media/latest>
[23:44:01.759] DEBUG (27772): pact-core@13.12.2: adding <https://cloudmargin.pactflow.io/pacts/provider/Provider-Backend/consumer/Consumer-Personal-Media/latest> as a Url source
[23:44:01.760] DEBUG (27772): pact-core@13.12.2: the optional ffi function 'pactffiVerifierAddProviderTransport' was not executed as it had non-fatal validation errors: No additional provider transports provided
2022-11-29T23:44:02.601006Z DEBUG reqwest-internal-sync-runtime h2::client: binding client connection
2022-11-29T23:44:02.601521Z DEBUG reqwest-internal-sync-runtime h2::client: client connection bound
2022-11-29T23:44:02.601821Z DEBUG reqwest-internal-sync-runtime h2::codec::framed_write: send frame=Settings { flags: (0x0), enable_push: 0, initial_window_size: 2097152, max_frame_size: 16384 }
2022-11-29T23:44:02.605944Z DEBUG reqwest-internal-sync-runtime Connection{peer=Client}: h2::codec::framed_read: received frame=Settings { flags: (0x0), max_concurrent_streams: 128, initial_window_size: 65536, max_frame_size: 16777215 }
2022-11-29T23:44:02.606854Z DEBUG reqwest-internal-sync-runtime Connection{peer=Client}: h2::codec::framed_write: send frame=Settings { flags: (0x1: ACK) }
2022-11-29T23:44:02.607103Z DEBUG reqwest-internal-sync-runtime Connection{peer=Client}: h2::codec::framed_read: received frame=WindowUpdate { stream_id: StreamId(0), size_increment: 2147418112 }
2022-11-29T23:44:02.607584Z DEBUG reqwest-internal-sync-runtime Connection{peer=Client}: h2::codec::framed_write: send frame=WindowUpdate { stream_id: StreamId(0), size_increment: 5177345 }
2022-11-29T23:44:02.608675Z DEBUG reqwest-internal-sync-runtime hyper::client::pool: pooling idle connection for ("https", <http://cloudmargin.pactflow.io|cloudmargin.pactflow.io>)
2022-11-29T23:44:02.609937Z DEBUG reqwest-internal-sync-runtime Connection{peer=Client}: h2::codec::framed_write: send frame=Headers { stream_id: StreamId(1)
RUNS __tests__/provider.js
2022-11-29T23:44:03.175136Z DEBUG reqwest-internal-sync-runtime Connection{peer=Client}: h2::codec::framed_read: received frame=Settings { flags: (0x1: ACK) }
2022-11-29T23:44:03.176250Z DEBUG reqwest-internal-sync-runtime Connection{peer=Client}: h2::proto::settings: received settings ACK; applying Settings { flags: (0x0), enable_push: 0, initial_window_size: 2097152, max_frame_size: 16384 }
2022-11-29T23:44:03.232264Z DEBUG reqwest-internal-sync-runtime Connection{peer=Client}: h2::codec::framed_read: received frame=Headers { stream_id: StreamId(1), flags: (0x4: END_HEADERS) }
2022-11-29T23:44:03.232688Z DEBUG reqwest-internal-sync-runtime Connection{peer=Client}: h2::codec::framed_read: received frame=Data { stream_id: StreamId(1) }
2022-11-29T23:44:03.240502Z DEBUG reqwest-internal-sync-runtime Connection{peer=Client}: h2::codec::framed_read: received frame=Data { stream_id: StreamId(1), flags: (0x1: END_STREAM) }
2022-11-29T23:44:03.247294Z INFO ThreadId(02) pact_verifier::pact_broker: Fetching path '/' from pact broker
2022-11-29T23:44:03.247746Z DEBUG tokio-runtime-worker hyper::client::connect::dns: resolving host="<http://cloudmargin.pactflow.io|cloudmargin.pactflow.io>"
2022-11-29T23:44:03.248371Z DEBUG ThreadId(02) hyper::client::connect::http: connecting to 3.105.11.81:443
RUNS __tests__/provider.js
2022-11-29T23:44:04.045581Z DEBUG ThreadId(02) h2::client: binding client connection
2022-11-29T23:44:04.046611Z DEBUG ThreadId(02) h2::client: client connection bound
2022-11-29T23:44:04.047334Z DEBUG ThreadId(02) h2::codec::framed_write: send frame=Settings { flags: (0x0), enable_push: 0, initial_window_size: 2097152, max_frame_size: 16384 }
2022-11-29T23:44:04.048536Z DEBUG tokio-runtime-worker Connection{peer=Client}: h2::codec::framed_read: received frame=Settings { flags: (0x0), max_concurrent_streams: 128, initial_window_size: 65536, max_frame_size: 16777215 }
2022-11-29T23:44:04.049461Z DEBUG tokio-runtime-worker Connection{peer=Client}: h2::codec::framed_write: send frame=Settings { flags: (0x1: ACK) }
2022-11-29T23:44:04.050268Z DEBUG tokio-runtime-worker Connection{peer=Client}: h2::codec::framed_read: received frame=WindowUpdate { stream_id: StreamId(0), size_increment: 2147418112 }
2022-11-29T23:44:04.051294Z DEBUG tokio-runtime-worker Connection{peer=Client}: h2::codec::framed_write: send frame=WindowUpdate { stream_id: StreamId(0), size_increment: 5177345 }
2022-11-29T23:44:04.048574Z DEBUG ThreadId(02) hyper::client::pool: pooling idle connection for ("https", <http://cloudmargin.pactflow.io|cloudmargin.pactflow.io>)
2022-11-29T23:44:04.053296Z DEBUG tokio-runtime-worker Connection{peer=Client}: h2::codec::framed_write: send frame=Headers { stream_id: StreamId(1), flags: (0x5: END_HEADERS | END_STREAM) }
2022-11-29T23:44:04.615780Z DEBUG tokio-runtime-worker Connection{peer=Client}: h2::codec::framed_read: received frame=Settings { flags: (0x1: ACK) }
2022-11-29T23:44:04.617523Z DEBUG tokio-runtime-worker Connection{peer=Client}: h2::proto::settings: received settings ACK; applying Settings { flags: (0x0), enable_push: 0, initial_window_size: 2097152, max_frame_size: 16384 }
2022-11-29T23:44:04.650339Z DEBUG tokio-runtime-worker Connection{peer=Client}: h2::codec::framed_read: received frame=Headers { stream_id: StreamId(1), flags: (0x4: END_HEADERS) }
2022-11-29T23:44:04.651488Z DEBUG tokio-runtime-worker Connection{peer=Client}: h2::codec::framed_read: received frame=Data { stream_id: StreamId(1) }
2022-11-29T23:44:04.652628Z DEBUG tokio-runtime-worker Connection{peer=Client}: h2::codec::framed_read: received frame=Data { stream_id: StreamId(1), flags: (0x1: END_STREAM) }
2022-11-29T23:44:04.654178Z DEBUG tokio-runtime-worker Connection{peer=Client}: h2::codec::framed_write: send frame=GoAway { error_code: NO_ERROR, last_stream_id: StreamId(0) }
2022-11-29T23:44:04.654210Z ERROR ThreadId(02) pact_verifier: Failed to load pact - Failed to load pact '<https://cloudmargin.pactflow.io/pacts/provider/Provider-Backend/consumer/Consumer-Personal-Media/latest>' - Request failed with status - 401 UnauthorizedMatt (pactflow.io / pact-js / pact-go)
auth=User(<mailto:michael.oosarumwense@gmail.com|michael.oosarumwense@gmail.com>, Mich***********)
☝️ have you got other credentials in your environment?Matt (pactflow.io / pact-js / pact-go)
PACT_ (e.g. env | grep PACT)michael osarumwense
11/30/2022, 12:05 AMmichael osarumwense
11/30/2022, 12:19 AMMatt (pactflow.io / pact-js / pact-go)
My guess is I shouldn’t be passing the authentication as a verifier option, but all of the examples i have seen doesn’t specify or state that authentication is required to verify a pactwhere does it say this?
Matt (pactflow.io / pact-js / pact-go)
no i don’t, i was a bit skeptical about the token not working so i tried switching from token to username and passwordyou can’t use username/passwords for Pactflow API usage
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
michael osarumwense
12/01/2022, 12:38 AMconst { Verifier } = require('@pact-foundation/pact');
but pact was expecting
const { Verifier } = require('@pact-foundation/pact-node');
also
return new Verifier(opts).verifyProvider().then((output) =>
but pact was expecting
return new Verifier(opts).verify().then((output) =>
lastly, in my dotenv file i had my token and my basic auth credentials defined but was only calling the token to be used for the verifier pact file but it would not let me until i deleted the username and password from my dotenv file and left just the token.Matt (pactflow.io / pact-js / pact-go)
PACT_ environment variables are read in by the tooling automatically. This is so you can export them in CI etc. and it just passes through