pactflow / example-bi-directional-consumer-cypress

Cypress bi-directional contract testing example project
MIT License
8 stars 27 forks source link

Doesn't work on Windows and WSL2 #65

Closed robert-dzikowski closed 1 year ago

robert-dzikowski commented 1 year ago

I tried to run this example on Windows 10 and WSL2 (this is Linux subsystem in Windows, something like VM with Ubuntu) and I got the following error:

$ make test
\n========== STAGE: test ✅ (cypress) ==========\n
npm run start:ui:and:test

> example-bi-directional-consumer-cypress@0.1.0 start:ui:and:test
> start-server-and-test start http://localhost:3000 cypress:headless:chrome

1: starting server using command "npm run start"
and when url "[ 'http://localhost:3000' ]" is responding with HTTP status code 200
running tests using command "npm run cypress:headless:chrome"

> example-bi-directional-consumer-cypress@0.1.0 start
> react-scripts start

i 「wds」: Project is running at http://192.168.1.39/
i 「wds」: webpack output is served from
i 「wds」: Content not from webpack is served from C:\working\pactflow\example-bi-directional-consumer-cypress\public
i 「wds」: 404s will fallback to /
Starting the development server...

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:140:10)
    at module.exports (C:\working\pactflow\example-bi-directional-consumer-cypress\node_modules\webpack\lib\util\createHash.js:135:53)
    at NormalModule._initBuildHash (C:\working\pactflow\example-bi-directional-consumer-cypress\node_modules\webpack\lib\NormalModule.js:417:16)
    at handleParseError (C:\working\pactflow\example-bi-directional-consumer-cypress\node_modules\webpack\lib\NormalModule.js:471:10)
    at C:\working\pactflow\example-bi-directional-consumer-cypress\node_modules\webpack\lib\NormalModule.js:503:5
    at C:\working\pactflow\example-bi-directional-consumer-cypress\node_modules\webpack\lib\NormalModule.js:358:12
    at C:\working\pactflow\example-bi-directional-consumer-cypress\node_modules\loader-runner\lib\LoaderRunner.js:373:3
    at iterateNormalLoaders (C:\working\pactflow\example-bi-directional-consumer-cypress\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
    at iterateNormalLoaders (C:\working\pactflow\example-bi-directional-consumer-cypress\node_modules\loader-runner\lib\LoaderRunner.js:221:10)
C:\working\pactflow\example-bi-directional-consumer-cypress\node_modules\react-scripts\scripts\start.js:19
  throw err;
  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:140:10)
    at module.exports (C:\working\pactflow\example-bi-directional-consumer-cypress\node_modules\webpack\lib\util\createHash.js:135:53)
    at NormalModule._initBuildHash (C:\working\pactflow\example-bi-directional-consumer-cypress\node_modules\webpack\lib\NormalModule.js:417:16)
    at C:\working\pactflow\example-bi-directional-consumer-cypress\node_modules\webpack\lib\NormalModule.js:452:10
    at C:\working\pactflow\example-bi-directional-consumer-cypress\node_modules\webpack\lib\NormalModule.js:323:13
    at C:\working\pactflow\example-bi-directional-consumer-cypress\node_modules\loader-runner\lib\LoaderRunner.js:367:11
    at C:\working\pactflow\example-bi-directional-consumer-cypress\node_modules\loader-runner\lib\LoaderRunner.js:233:18
    at context.callback (C:\working\pactflow\example-bi-directional-consumer-cypress\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
    at C:\working\pactflow\example-bi-directional-consumer-cypress\node_modules\babel-loader\lib\index.js:59:103 {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Node.js v19.3.0
Error: server closed unexpectedly
    at ChildProcess.onClose (C:\working\pactflow\example-bi-directional-consumer-cypress\node_modules\start-server-and-test\src\index.js:75:14)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1098:16)
    at ChildProcess._handle.onexit (node:internal/child_process:304:5)
make: *** [test] Error 1
mefellows commented 1 year ago

Error: error:0308010C:digital envelope routines::unsupported

Ah, I've actually seen this before . It's a bug in the version of webpack and Node 18+ (the SSL dependency has changed).

You can fix this in one of the two following ways:

  1. export NODE_OPTIONS=--openssl-legacy-provider
  2. Using a version of node < 18
robert-dzikowski commented 1 year ago

It works now in Windows 10 (you don't need WSL2). You should add to readme.md that before running tests you must start provider.