thomvaill / log4brains

✍️ Log and publish your architecture decisions (ADR)
Apache License 2.0
1.15k stars 94 forks source link

Log4brains is broken on Node v18.x #85

Closed thomvaill closed 1 month ago

thomvaill commented 2 years ago

Bug Report

Steps to Reproduce

nvm use 18
log4brains build

# output:
Building Log4brains...
[Next]  Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Proxy.createHash (node:crypto:133:10)
    at module.exports.__webpack_modules__.15660.module.exports (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:111680:62)
    at NormalModule._initBuildHash (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:85092:16)
    at handleParseError (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:85146:10)
    at /opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:85178:5
    at /opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:85033:12
    at /opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:51096:3
    at iterateNormalLoaders (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:50937:10)
    at iterateNormalLoaders (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:509[44](https://github.com/thomvaill/log4brains/actions/runs/3107331593/jobs/5035316854#step:4:45):10)
    at /opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:50959:3
    at runSyncOrAsync (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:50853:11)
    at iterateNormalLoaders (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:50955:2)
    at processResource (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:50931:3)
    at iteratePitchingLoaders (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:50881:10)
    at iteratePitchingLoaders (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:50888:10)
[Next]  Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Proxy.createHash (node:crypto:133:10)
    at module.exports.__webpack_modules__.15660.module.exports (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:111680:62)
    at NormalModule._initBuildHash (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:85092:16)
    at handleParseError (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:851[46](https://github.com/thomvaill/log4brains/actions/runs/3107331593/jobs/5035316854#step:4:47):10)
    at /opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:85178:5
    at /opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:85033:12
    at /opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:51096:3
    at iterateNormalLoaders (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:50937:10)
    at iterateNormalLoaders (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:50944:10)
    at /opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:50959:3
    at runSyncOrAsync (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:50853:11)
    at iterateNormalLoaders (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:50955:2)
    at processResource (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:50931:3)
    at iteratePitchingLoaders (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:50881:10)
    at iteratePitchingLoaders (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:50888:10)
[Next]  Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Proxy.createHash (node:crypto:133:10)
    at module.exports.__webpack_modules__.15660.module.exports (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:111680:62)
    at NormalModule._initBuildHash (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:85092:16)
    at handleParseError (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:85146:10)
    at /opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:85178:5
    at /opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:85033:12
    at /opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:51096:3
    at iterateNormalLoaders (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:50937:10)
    at iterateNormalLoaders (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:50944:10)
    at /opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:50959:3
    at runSyncOrAsync (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:50853:11)
    at iterateNormalLoaders (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:50955:2)
    at processResource (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:50931:3)
    at iteratePitchingLoaders (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:50881:10)
    at iteratePitchingLoaders (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:50888:10)
[Next]  Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Proxy.createHash (node:crypto:133:10)
    at module.exports.__webpack_modules__.15660.module.exports (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:111680:62)
    at NormalModule._initBuildHash (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:85092:16)
    at handleParseError (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:85146:10)
    at /opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:85178:5
    at /opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:85033:12
    at /opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:51096:3
    at iterateNormalLoaders (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:50937:10)
    at iterateNormalLoaders (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:50944:10)
    at /opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:50959:3
    at runSyncOrAsync (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:50853:11)
    at iterateNormalLoaders (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:50955:2)
    at processResource (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:50931:3)
    at iteratePitchingLoaders (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:50881:10)
    at iteratePitchingLoaders (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:50888:10)
node:internal/crypto/hash:71
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Proxy.createHash (node:crypto:133:10)
    at module.exports.__webpack_modules__.15660.module.exports (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:111680:62)
    at NormalModule._initBuildHash (/opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:85092:16)
    at /opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:85127:10
    at /opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:8[49](https://github.com/thomvaill/log4brains/actions/runs/3107331593/jobs/5035316854#step:4:50)98:13
    at /opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:51090:11
    at /opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:[50](https://github.com/thomvaill/log4brains/actions/runs/3107331593/jobs/5035316854#step:4:51)9[56](https://github.com/thomvaill/log4brains/actions/runs/3107331593/jobs/5035316854#step:4:57):18
    at context.callback (/opt/hostedtoolcache/node/18.9.0/x[64](https://github.com/thomvaill/log4brains/actions/runs/3107331593/jobs/5035316854#step:4:65)/lib/node_modules/log4brains/node_modules/next/dist/compiled/webpack/bundle4.js:50[83](https://github.com/thomvaill/log4brains/actions/runs/3107331593/jobs/5035316854#step:4:84)4:13)
    at /opt/hostedtoolcache/node/18.9.0/x64/lib/node_modules/log4brains/node_modules/next/dist/build/webpack/loaders/babel-loader/src/index.js:4:106 {
  opensslErrorStack: [ 'error:030000[86](https://github.com/thomvaill/log4brains/actions/runs/3107331593/jobs/5035316854#step:4:87):digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Expected Behavior

Should work :-)

Environment

Possible Solution

Probably some dependency updates.

creinig commented 2 years ago

Reason is a bug in webpack that's fixed in webpack 5.61.0. log4brains uses webpack-bundle-analyzer 4.3.0 which in turn depends on webpack. The current webpack-bundle-analyzer (4.7.0) however still depends on webpack-5.37.1, so simply moving to the latest version here won't fix the problem (yet).

See this stackoverflow answer

thomvaill commented 1 month ago

114 did not fix as the workaround environment variable is still needed during the use of the log4brains CLI, which is not acceptable. We have to update our dependencies to fix correctly this issue instead

thomvaill commented 1 month ago

114 did not fix as the workaround environment variable is still needed during the use of the log4brains CLI, which is not acceptable. We have to update our dependencies to fix correctly this issue instead

I think I found a way by spawning a new node process with the correct environment variable. Let's see in #124