pact-foundation / pact-js-core

Core binaries for pact-js, a Contract Testing Framework. NOTE: If you are looking to do Pact contract testing in node, you almost certainly want pact-js, not pact-node.
https://docs.pact.io
MIT License
150 stars 79 forks source link

Error while installing binary: Checksum rejected #282

Closed michelneufeglise closed 2 years ago

michelneufeglise commented 3 years ago

Software versions

Please provide at least OS and version of pact-js

Issue Checklist

Please confirm the following:

Expected behaviour

the pact_binary_location is set to company specifik location and download from there works fine !

Actual behaviour

Checksum error when installing binary on both OSX and Linux build servers

Error while installing binary: Checksum rejected for file 'pact-1.88.49-osx.tar.gz' with checksum pact-1.88.49-osx.tar.gz.checksum

Steps to reproduce

How can someone else reproduce this bug? Change the pact_binary_location for all 9.* versions

For extra bonus points and internet karma, provide a repository, gist or reproducible code snippet so that we can test the problem.

We recommend forking the project and modifying a relevant example in the examples folder

Relevant log files

Please ensure you set logging to DEBUG and attach any relevant log files here (or link to a gist).

TimothyJones commented 3 years ago

Can you confirm what version of the pact binary you are providing locally?

Whatever it is, it will need to match the one used in the error message. This version is controlled by the version of pact-node (note, not pact-js). You may need to pin that version in your package.json.

Sent from my mobile

On 23 Apr 2021, at 8:43 pm, michel @.***> wrote:

 Software versions

Please provide at least OS and version of pact-js

OS: _e.g. Mac OSX Catalina 10.15.5 Consumer Pact library: @.***/pact": "^9.15.5", Node Version: v14.15.4 Issue Checklist

Please confirm the following:

[ x] I have upgraded to the latest [ x] I have the read the FAQs in the Readme [ x] I have triple checked, that there are no unhandled promises in my code I have set my log level to debug and attached a log file showing the complete request/response cycle For bonus points and virtual high fives, I have created a reproduceable git repository (see below) to illustrate the problem Expected behaviour

the pact_binary_location is set to company specifik location and download from there works fine !

Actual behaviour

Checksum error when installing binary on both OSX and Linux build servers

Error while installing binary: Checksum rejected for file 'pact-1.88.49-osx.tar.gz' with checksum pact-1.88.49-osx.tar.gz.checksum

Steps to reproduce

How can someone else reproduce this bug? Change the pact_binary_location for all 9.* versions

For extra bonus points and internet karma, provide a repository, gist or reproducible code snippet so that we can test the problem.

We recommend forking the project and modifying a relevant example in the examples folder

Relevant log files

Please ensure you set logging to DEBUG and attach any relevant log files here (or link to a gist).

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

mefellows commented 3 years ago

Thanks Michel - appreciate you taking the time to create an account and raise this!

I'm going to add some debug notes that I took relating to this issue (we were discussing offline).

Some tests

I've just tested this function locally. I first blackholed github to prevent the installer from getting out and downloading key assets, by adding a host entry:

➜  cat /etc/hosts | grep github
0.0.0.0 github.com

And then tried installing with both versions of the below (separately, obviously):

  "config": {
    "pact_binary_location": "/tmp",
    "pact_binary_location": "https://pactflow-static-assets.s3-ap-southeast-2.amazonaws.com/"
  }

It expects a file with this exact name to be there: pact-1.88.49-osx.tar.gz

Both of the above installs just fine, here's the output for the one uploaded to S3:

➜  npm i @pact-foundation/pact                                                                                                                                                                                                                                                                      <aws:pact-prod>
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
> @pact-foundation/pact-node@10.12.2 postinstall /private/tmp/bintest/node_modules/@pact-foundation/pact-node
> node postinstall.js
Installing Pact Standalone Binary for darwin.
Downloading Pact Standalone Binary v1.88.49 for platform darwin from https://pactflow-static-assets.s3-ap-southeast-2.amazonaws.com/pact-1.88.49-osx.tar.gz
Please note: we are tracking this download anonymously to gather important usage statistics. To disable tracking, set 'pact_do_not_track: true' in your package.json 'config' section.
Downloaded 23.50%...
Downloaded 33.48%...
Downloaded 41.47%...
Downloaded 48.12%...
Downloaded 56.11%...
Downloaded 67.87%...
Downloaded 80.96%...
Downloaded 94.27%...
Finished downloading binary to /private/tmp/bintest/node_modules/@pact-foundation/pact-node/standalone/pact-1.88.49-osx.tar.gz
Extracting binary from /private/tmp/bintest/node_modules/@pact-foundation/pact-node/standalone/pact-1.88.49-osx.tar.gz.
Checksum passed for 'pact-1.88.49-osx.tar.gz'.
Extraction done.

### If you ❤ Pact and want to support us, please donate here: http://donate.pact.io/node

Pact Standalone Binary is ready.
npm WARN bintest@1.0.0 No description
npm WARN bintest@1.0.0 No repository field.
+ @pact-foundation/pact@9.15.5
added 373 packages from 359 contributors and audited 373 packages in 29.189s
8 packages are looking for funding
  run `npm fund` for details
found 0 vulnerabilities

Findings The checksums don't need to be downloaded locally. As noted above, I only placed the binaries into the target and not the checksums. It seems they are included in the actual package

You can check this by downloading the actual npm tarball, extracting it and taking a look:

mkdir /tmp/issue-645; cd /tmp/issue-645; wget `npm v @pact-foundation/pact-node dist.tarball`; tar -xvvf pact-node*.tgz; find . -name "*checksum*"

Which should produce something like this:

--2021-04-23 21:39:24--  https://registry.npmjs.org/@pact-foundation/pact-node/-/pact-node-10.12.2.tgz
Resolving registry.npmjs.org (registry.npmjs.org)... 104.16.16.35, 104.16.25.35, 104.16.18.35, ...
Connecting to registry.npmjs.org (registry.npmjs.org)|104.16.16.35|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 64034 (63K) [application/octet-stream]
Saving to: ‘pact-node-10.12.2.tgz’

pact-node-10.12.2.tgz                                                          100%[====================================================================================================================================================================================================>]  62.53K  --.-KB/s    in 0.02s

2021-04-23 21:39:24 (3.92 MB/s) - ‘pact-node-10.12.2.tgz’ saved [64034/64034]

x -rw-r--r--  0 0      0          22 26 Oct  1985 package/.eslintignore
x -rw-r--r--  0 0      0         714 26 Oct  1985 package/.eslintrc
x -rw-r--r--  0 0      0          11 26 Oct  1985 package/.prettierignore
x -rw-r--r--  0 0      0         508 26 Oct  1985 package/.snyk
x -rw-r--r--  0 0      0        1083 26 Oct  1985 package/LICENSE
x -rw-r--r--  0 0      0          75 26 Oct  1985 package/standalone/pact-1.88.37-linux-x86_64.tar.gz.checksum
x -rw-r--r--  0 0      0          72 26 Oct  1985 package/standalone/pact-1.88.37-linux-x86.tar.gz.checksum
x -rw-r--r--  0 0      0          66 26 Oct  1985 package/standalone/pact-1.88.37-osx.tar.gz.checksum
x -rw-r--r--  0 0      0          65 26 Oct  1985 package/standalone/pact-1.88.37-win32.zip.checksum
x -rw-r--r--  0 0      0          75 26 Oct  1985 package/standalone/pact-1.88.45-linux-x86_64.tar.gz.checksum
x -rw-r--r--  0 0      0          72 26 Oct  1985 package/standalone/pact-1.88.45-linux-x86.tar.gz.checksum
x -rw-r--r--  0 0      0          66 26 Oct  1985 package/standalone/pact-1.88.45-osx.tar.gz.checksum
x -rw-r--r--  0 0      0          65 26 Oct  1985 package/standalone/pact-1.88.45-win32.zip.checksum
x -rw-r--r--  0 0      0          75 26 Oct  1985 package/standalone/pact-1.88.48-linux-x86_64.tar.gz.checksum
x -rw-r--r--  0 0      0          72 26 Oct  1985 package/standalone/pact-1.88.48-linux-x86.tar.gz.checksum
x -rw-r--r--  0 0      0          66 26 Oct  1985 package/standalone/pact-1.88.48-osx.tar.gz.checksum
x -rw-r--r--  0 0      0          65 26 Oct  1985 package/standalone/pact-1.88.48-win32.zip.checksum
x -rw-r--r--  0 0      0          75 26 Oct  1985 package/standalone/pact-1.88.49-linux-x86_64.tar.gz.checksum
x -rw-r--r--  0 0      0          72 26 Oct  1985 package/standalone/pact-1.88.49-linux-x86.tar.gz.checksum
x -rw-r--r--  0 0      0          66 26 Oct  1985 package/standalone/pact-1.88.49-osx.tar.gz.checksum
x -rw-r--r--  0 0      0          65 26 Oct  1985 package/standalone/pact-1.88.49-win32.zip.checksum
x -rw-r--r--  0 0      0         757 26 Oct  1985 package/test/ssl/server.crt
x -rw-r--r--  0 0      0         176 26 Oct  1985 package/.mocharc.js
x -rw-r--r--  0 0      0        1696 26 Oct  1985 package/src/spawn/arguments.js
x -rw-r--r--  0 0      0       18277 26 Oct  1985 package/test/integration/broker-mock.js
x -rw-r--r--  0 0      0        6225 26 Oct  1985 package/src/can-deploy.js
x -rw-r--r--  0 0      0         717 26 Oct  1985 package/test/integration/data-utils.js
x -rw-r--r--  0 0      0          53 26 Oct  1985 package/download-checksums.js
x -rw-r--r--  0 0      0         478 26 Oct  1985 package/src/index.js
x -rw-r--r--  0 0      0         310 26 Oct  1985 package/src/spawn/index.js
x -rw-r--r--  0 0      0       14252 26 Oct  1985 package/standalone/install.js
x -rw-r--r--  0 0      0         173 26 Oct  1985 package/jest.config.js
x -rw-r--r--  0 0      0         975 26 Oct  1985 package/src/logger.js
x -rw-r--r--  0 0      0        3855 26 Oct  1985 package/src/message.js
x -rw-r--r--  0 0      0         392 26 Oct  1985 package/bin/pact-broker.js
x -rw-r--r--  0 0      0         728 26 Oct  1985 package/src/pact-environment.js
x -rw-r--r--  0 0      0         394 26 Oct  1985 package/bin/pact-message.js
x -rw-r--r--  0 0      0         398 26 Oct  1985 package/bin/pact-mock-service.js
x -rw-r--r--  0 0      0         405 26 Oct  1985 package/bin/pact-provider-verifier.js
x -rw-r--r--  0 0      0        1933 26 Oct  1985 package/src/pact-standalone.js
x -rw-r--r--  0 0      0         396 26 Oct  1985 package/bin/pact-stub-service.js
x -rw-r--r--  0 0      0         383 26 Oct  1985 package/bin/pact.js
x -rw-r--r--  0 0      0        5196 26 Oct  1985 package/src/pact.js
x -rw-r--r--  0 0      0         185 26 Oct  1985 package/postinstall.js
x -rw-r--r--  0 0      0        2816 26 Oct  1985 package/test/integration/provider-mock.js
x -rw-r--r--  0 0      0        4398 26 Oct  1985 package/src/publisher.js
x -rw-r--r--  0 0      0        3685 26 Oct  1985 package/src/server.js
x -rw-r--r--  0 0      0        9176 26 Oct  1985 package/src/service.js
x -rw-r--r--  0 0      0        3068 26 Oct  1985 package/src/spawn/spawn.js
x -rw-r--r--  0 0      0        2046 26 Oct  1985 package/src/stub.js
x -rw-r--r--  0 0      0          66 26 Oct  1985 package/ts-node.js
x -rw-r--r--  0 0      0        9263 26 Oct  1985 package/src/verifier.js
x -rw-r--r--  0 0      0        2134 26 Oct  1985 package/test/integration/data/get-noauth-provider_they-consumer_anotherclient-latest.json
x -rw-r--r--  0 0      0        2112 26 Oct  1985 package/test/integration/data/get-noauth-provider_they-consumer_me-latest.json
x -rw-r--r--  0 0      0        2134 26 Oct  1985 package/test/integration/data/get-provider_they-consumer_anotherclient-latest.json
x -rw-r--r--  0 0      0        2112 26 Oct  1985 package/test/integration/data/get-provider_they-consumer_me-latest.json
x -rw-r--r--  0 0      0         437 26 Oct  1985 package/test/integration/me-they-fail.json
x -rw-r--r--  0 0      0         773 26 Oct  1985 package/test/integration/me-they-multi.json
x -rw-r--r--  0 0      0         740 26 Oct  1985 package/test/integration/me-they-post-regex-success.json
x -rw-r--r--  0 0      0         620 26 Oct  1985 package/test/integration/me-they-post-success.json
x -rw-r--r--  0 0      0         502 26 Oct  1985 package/test/integration/me-they-states.json
x -rw-r--r--  0 0      0         426 26 Oct  1985 package/test/integration/me-they-success.json
x -rw-r--r--  0 0      0         426 26 Oct  1985 package/test/integration/me-they-weird path-success.json
x -rw-r--r--  0 0      0        5459 26 Oct  1985 package/package.json
x -rw-r--r--  0 0      0         348 26 Oct  1985 package/test/integration/publish/publish-fail.json
x -rw-r--r--  0 0      0         437 26 Oct  1985 package/test/integration/publish/pactDirTests/publish-success.json
x -rw-r--r--  0 0      0         437 26 Oct  1985 package/test/integration/publish/pactDirTestsWithOtherStuff/publish-success.json
x -rw-r--r--  0 0      0         437 26 Oct  1985 package/test/integration/publish/publish-success.json
x -rw-r--r--  0 0      0         438 26 Oct  1985 package/test/integration/publish/pactDirTests/publish-success2.json
x -rw-r--r--  0 0      0         438 26 Oct  1985 package/test/integration/publish/pactDirTestsWithOtherStuff/publish-success2.json
x -rw-r--r--  0 0      0        2206 26 Oct  1985 package/test/integration/publish-verification-example weird path-success.json
x -rw-r--r--  0 0      0        2177 26 Oct  1985 package/test/integration/publish-verification-example-fail.json
x -rw-r--r--  0 0      0        2206 26 Oct  1985 package/test/integration/publish-verification-example-success.json
x -rw-r--r--  0 0      0          45 26 Oct  1985 package/.vscode/settings.json
x -rw-r--r--  0 0      0         572 26 Oct  1985 package/tsconfig.json
x -rw-r--r--  0 0      0         150 26 Oct  1985 package/tsconfig.spec.json
x -rw-r--r--  0 0      0         887 26 Oct  1985 package/test/ssl/server.key
x -rw-r--r--  0 0      0        1850 26 Oct  1985 package/src/spawn/arguments.js.map
x -rw-r--r--  0 0      0        9491 26 Oct  1985 package/test/integration/broker-mock.js.map
x -rw-r--r--  0 0      0        4280 26 Oct  1985 package/src/can-deploy.js.map
x -rw-r--r--  0 0      0         692 26 Oct  1985 package/test/integration/data-utils.js.map
x -rw-r--r--  0 0      0         244 26 Oct  1985 package/src/index.js.map
x -rw-r--r--  0 0      0         146 26 Oct  1985 package/src/spawn/index.js.map
x -rw-r--r--  0 0      0         897 26 Oct  1985 package/src/logger.js.map
x -rw-r--r--  0 0      0        2891 26 Oct  1985 package/src/message.js.map
x -rw-r--r--  0 0      0         361 26 Oct  1985 package/bin/pact-broker.js.map
x -rw-r--r--  0 0      0         429 26 Oct  1985 package/src/pact-environment.js.map
x -rw-r--r--  0 0      0         363 26 Oct  1985 package/bin/pact-message.js.map
x -rw-r--r--  0 0      0         377 26 Oct  1985 package/bin/pact-mock-service.js.map
x -rw-r--r--  0 0      0         385 26 Oct  1985 package/bin/pact-provider-verifier.js.map
x -rw-r--r--  0 0      0        1835 26 Oct  1985 package/src/pact-standalone.js.map
x -rw-r--r--  0 0      0         373 26 Oct  1985 package/bin/pact-stub-service.js.map
x -rw-r--r--  0 0      0         347 26 Oct  1985 package/bin/pact.js.map
x -rw-r--r--  0 0      0        4123 26 Oct  1985 package/src/pact.js.map
x -rw-r--r--  0 0      0        2385 26 Oct  1985 package/test/integration/provider-mock.js.map
x -rw-r--r--  0 0      0        3415 26 Oct  1985 package/src/publisher.js.map
x -rw-r--r--  0 0      0        2536 26 Oct  1985 package/src/server.js.map
x -rw-r--r--  0 0      0        7363 26 Oct  1985 package/src/service.js.map
x -rw-r--r--  0 0      0        2113 26 Oct  1985 package/src/spawn/spawn.js.map
x -rw-r--r--  0 0      0        1072 26 Oct  1985 package/src/stub.js.map
x -rw-r--r--  0 0      0        7119 26 Oct  1985 package/src/verifier.js.map
x -rw-r--r--  0 0      0        1611 26 Oct  1985 package/.github/ISSUE_TEMPLATE/bug_report.md
x -rwxr-xr-x  0 0      0       31840 26 Oct  1985 package/CHANGELOG.md
x -rw-r--r--  0 0      0        3036 26 Oct  1985 package/CONTRIBUTING.md
x -rw-r--r--  0 0      0         201 26 Oct  1985 package/DEVELOPER.md
x -rw-r--r--  0 0      0        1034 26 Oct  1985 package/.github/ISSUE_TEMPLATE/feature_request.md
x -rw-r--r--  0 0      0         921 26 Oct  1985 package/.github/issue_template.md
x -rw-r--r--  0 0      0        1090 26 Oct  1985 package/.github/pull_request_template.md
x -rw-r--r--  0 0      0       27213 26 Oct  1985 package/README.md
x -rw-r--r--  0 0      0        3035 26 Oct  1985 package/RELEASING.md
x -rw-r--r--  0 0      0         244 26 Oct  1985 package/test/monkeypatch.rb
x -rwxr-xr-x  0 0      0         209 26 Oct  1985 package/script/ci/build-and-test.sh
x -rwxr-xr-x  0 0      0         599 26 Oct  1985 package/script/ci/lib/create_npmrc_file.sh
x -rwxr-xr-x  0 0      0         821 26 Oct  1985 package/script/create-pr-to-update-pact-ruby-standalone.sh
x -rwxr-xr-x  0 0      0         268 26 Oct  1985 package/script/ci/lib/get-version.sh
x -rwxr-xr-x  0 0      0         457 26 Oct  1985 package/script/ci/lib/publish.sh
x -rwxr-xr-x  0 0      0        1559 26 Oct  1985 package/script/ci/release.sh
x -rwxr-xr-x  0 0      0         750 26 Oct  1985 package/script/ci/lib/robust-bash.sh
x -rwxr-xr-x  0 0      0        1030 26 Oct  1985 package/script/trigger-release.sh
x -rwxr-xr-x  0 0      0        1156 26 Oct  1985 package/script/trigger-update.sh
x -rw-r--r--  0 0      0         868 26 Oct  1985 package/src/spawn/arguments.d.ts
x -rw-r--r--  0 0      0         177 26 Oct  1985 package/test/integration/broker-mock.d.ts
x -rw-r--r--  0 0      0        1431 26 Oct  1985 package/src/can-deploy.d.ts
x -rw-r--r--  0 0      0         398 26 Oct  1985 package/test/integration/data-utils.d.ts
x -rw-r--r--  0 0      0         185 26 Oct  1985 package/src/index.d.ts
x -rw-r--r--  0 0      0          64 26 Oct  1985 package/src/spawn/index.d.ts
x -rw-r--r--  0 0      0        1099 26 Oct  1985 package/standalone/install.d.ts
x -rw-r--r--  0 0      0         374 26 Oct  1985 package/src/logger.d.ts
x -rw-r--r--  0 0      0         500 26 Oct  1985 package/src/message.d.ts
x -rw-r--r--  0 0      0          31 26 Oct  1985 package/bin/pact-broker.d.ts
x -rw-r--r--  0 0      0         176 26 Oct  1985 package/src/pact-environment.d.ts
x -rw-r--r--  0 0      0          31 26 Oct  1985 package/bin/pact-message.d.ts
x -rw-r--r--  0 0      0          31 26 Oct  1985 package/bin/pact-mock-service.d.ts
x -rw-r--r--  0 0      0          31 26 Oct  1985 package/bin/pact-provider-verifier.d.ts
x -rw-r--r--  0 0      0         549 26 Oct  1985 package/src/pact-standalone.d.ts
x -rw-r--r--  0 0      0          31 26 Oct  1985 package/bin/pact-stub-service.d.ts
x -rw-r--r--  0 0      0          31 26 Oct  1985 package/bin/pact.d.ts
x -rw-r--r--  0 0      0        1168 26 Oct  1985 package/src/pact.d.ts
x -rw-r--r--  0 0      0         177 26 Oct  1985 package/test/integration/provider-mock.d.ts
x -rw-r--r--  0 0      0         651 26 Oct  1985 package/src/publisher.d.ts
x -rw-r--r--  0 0      0         721 26 Oct  1985 package/src/server.d.ts
x -rw-r--r--  0 0      0        1649 26 Oct  1985 package/src/service.d.ts
x -rw-r--r--  0 0      0         407 26 Oct  1985 package/src/spawn/spawn.d.ts
x -rw-r--r--  0 0      0         563 26 Oct  1985 package/src/stub.d.ts
x -rw-r--r--  0 0      0        1583 26 Oct  1985 package/src/verifier.d.ts
x -rw-r--r--  0 0      0          67 26 Oct  1985 package/test/integration/publish/pactDirTestsWithOtherStuff/test.txt
x -rw-r--r--  0 0      0         662 26 Oct  1985 package/appveyor.yml
x -rw-r--r--  0 0      0         522 26 Oct  1985 package/.github/workflows/build-and-test.yml
x -rw-r--r--  0 0      0         528 26 Oct  1985 package/docker-compose.yml
x -rw-r--r--  0 0      0         959 26 Oct  1985 package/.github/workflows/publish.yml
x -rw-r--r--  0 0      0         551 26 Oct  1985 package/.github/workflows/update.yml
./package/standalone/pact-1.88.37-linux-x86_64.tar.gz.checksum
./package/standalone/pact-1.88.49-win32.zip.checksum
./package/standalone/pact-1.88.45-osx.tar.gz.checksum
./package/standalone/pact-1.88.37-win32.zip.checksum
./package/standalone/pact-1.88.49-linux-x86_64.tar.gz.checksum
./package/standalone/pact-1.88.49-linux-x86.tar.gz.checksum
./package/standalone/pact-1.88.48-osx.tar.gz.checksum
./package/standalone/pact-1.88.49-osx.tar.gz.checksum
./package/standalone/pact-1.88.37-osx.tar.gz.checksum
./package/standalone/pact-1.88.45-linux-x86.tar.gz.checksum
./package/standalone/pact-1.88.48-linux-x86.tar.gz.checksum
./package/standalone/pact-1.88.45-win32.zip.checksum
./package/standalone/pact-1.88.37-linux-x86.tar.gz.checksum
./package/standalone/pact-1.88.48-win32.zip.checksum
./package/standalone/pact-1.88.48-linux-x86_64.tar.gz.checksum
./package/standalone/pact-1.88.45-linux-x86_64.tar.gz.checksum
./package/download-checksums.js
TimothyJones commented 3 years ago

Thanks Matt, that's very helpful context.

It expects a file with this exact name to be there: pact-1.88.49-osx.tar.gz

It also expects that file to be that exact version (ie, you can't just rename another version of the binary). @michelneufeglise, can you confirm which version of the binary you have downloaded locally?

michelneufeglise commented 3 years ago

Hi Matt and Timothy,

Changing it to a local binary pact location worked fine, no problems with the checksums so it seems the problem is related to the git location of my company where it is stored, i am switching to a different location ( nexus ) for the binaries now to see if that does the trick but i think it will work. Will keep you updated about the results !

mefellows commented 3 years ago

Thanks Michel.

One hypothesis I have is that proxy settings might be getting in the way. i.e. when the system attempts to download the binary from your hosted git URL, it is passing through a proxy that is presenting an auth challenge (or similar). When the file is downloaded, it's not actually a zip file but most likely an HTML document.

I think we could add some more debugging into the package that enables trace logging, and we could print out what is happening.

What do you think Tim?

TimothyJones commented 3 years ago

So, while working on the (unrelated) FFI branch, I noticed that 404s during the download incorrectly result in a successful download that contains the 404 error instead of the binary. I think the error handling isn't quite right.

Could that be what is happening here? Have you tried opening the download up to see whether the file is the archive it is supposed to be?

mefellows commented 3 years ago

That certainly lends credence to the theory.

Doing it via a browser is not going to be the best debugging approach however, because likely any auth session would still be valid. When pact-node tries to download it, any credentials are unlikely to be passed along (because we don't have any mechanism to do so, outside of standard http_proxy and https_proxy), so that could be it.>

EDIT: I misread "Could that be what is happening here? Have you tried opening the download up to see whether the file is the archive it is supposed to be?". Yes, that would be ideal if you could please do that.

The file should be in node_modules/@pact-foundation/pact-node/standalone. If you could try and extract it, or see the contents of it, that'd be really helpful.

e.g. using the file command, I can see the one in my directory is a gzipped compressed file:

➜  file node_modules/@pact-foundation/pact-node/standalone/pact-1.88.49-osx.tar.gz                                                                                         
node_modules/@pact-foundation/pact-node/standalone/pact-1.88.49-osx.tar.gz: gzip compressed data, from Unix, original size modulo 2^32 25098240

If you see something else (e.g. a text file) it would be great to know.

michelneufeglise commented 3 years ago

Hi Matt and Timothy,

I am trying a really simple solution now, just added the four different os binaries to the same project which needs them, so it gets a relative local path. That works fine locally but off course that is to be expected, but I think it should also work fine on the build servers because there are no proxies in between anymore, again I will keep you updated !

rlagu commented 3 years ago

I am having same issue. Getting error while downloading nexus

image

working fine with local path

image

TimothyJones commented 3 years ago

We’re working on a permanent fix for this, by bundling the binaries with the package.

In the meantime, try opening the file in a text editor- usually it’s an error message from github or a proxy you have set up.

Also, if you’re able to try the beta release, I believe the most recent version has the binaries bundled with it. However, the release is not stable yet, so it might not suit your needs

BrendonReed commented 3 years ago

Hi, I experienced a similar issue, so just jumping in here to add what I found.

The issue for me was definitely the proxy -- I tracked it down to the switch from requests to needle for doing the download. I then replicated with a simple request vs needle file download. My corporate proxy worked fine with Request, but not with Needle. My guess is that it has to do with http vs https, something like the proxy is plain http even for https. Probably not an uncommon scenario for a corporate proxy.

If you're bundling the binaries then I suppose that would solve my issue as well, but I'm not sure of the timeline. Because most people don't use pact-js-core directly, is it simple to provide me a link to an issue or something that's tracking so I can get a better picture of when it might be available to me?

mefellows commented 3 years ago

The latest version of Pact JS (beta) bundles its dependency directly (https://github.com/pact-foundation/pact-js/#pact-js-v3), and better yet, it doesn't use Ruby under the hood (so no concerns around executable permissions on locked down corporate machines).

This project tracks the project of the work. You can see the MVP line for the next major release there - things are moving, but the interface is likely to change.

To solve the immediate problem, it seems that Needle does not support this (see https://github.com/tomas/needle/issues/336). It's possible we can detect the presence of the standard environment variables and then configure Needle on the fly. More preferably, we just bundle the dependency.

@BrendonReed IIRC you were also wanting to configure the location of the pre-downloaded artifacts. If that's still the case, please raise an issue and/or PR, we'd happily accept that if the beta release is not suitable for you.

mefellows commented 2 years ago

Closing as we have removed the install-time download from the latest.