ipfs-blog icon indicating copy to clipboard operation
ipfs-blog copied to clipboard

Build errors

Open 2color opened this issue 2 years ago • 1 comments

In recent PRs we got the follwing error:

12:53:21 PM 10/27/2022: ^
12:53:21 PM 10/27/2022: Error: error:0308010C:digital envelope routines::unsupported
12:53:21 PM 10/27/2022: at new Hash (node:internal/crypto/hash:71:19)
12:53:21 PM 10/27/2022: at Object.createHash (node:crypto:133:10)
12:53:21 PM 10/27/2022: at module.exports (/workspace/node_modules/webpack/lib/util/createHash.js:135:53)
12:53:21 PM 10/27/2022: at NormalModule._initBuildHash (/workspace/node_modules/webpack/lib/NormalModule.js:417:16)
12:53:21 PM 10/27/2022: at handleParseError (/workspace/node_modules/webpack/lib/NormalModule.js:471:10)
12:53:21 PM 10/27/2022: at /workspace/node_modules/webpack/lib/NormalModule.js:503:5
12:53:21 PM 10/27/2022: at /workspace/node_modules/webpack/lib/NormalModule.js:358:12
12:53:21 PM 10/27/2022: at /workspace/node_modules/loader-runner/lib/LoaderRunner.js:373:3
12:53:21 PM 10/27/2022: at iterateNormalLoaders (/workspace/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
12:53:21 PM 10/27/2022: at iterateNormalLoaders (/workspace/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
12:53:21 PM 10/27/2022: at /workspace/node_modules/loader-runner/lib/LoaderRunner.js:236:3
12:53:21 PM 10/27/2022: at context.callback (/workspace/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
12:53:21 PM 10/27/2022: at /workspace/node_modules/cache-loader/dist/index.js:134:7
12:53:21 PM 10/27/2022: at /workspace/node_modules/graceful-fs/graceful-fs.js:61:14
12:53:21 PM 10/27/2022: at FSReqCallback.oncomplete (node:fs:197:23) {
12:53:21 PM 10/27/2022: opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
12:53:21 PM 10/27/2022: library: 'digital envelope routines',
12:53:21 PM 10/27/2022: reason: 'unsupported',
12:53:21 PM 10/27/2022: code: 'ERR_OSSL_EVP_UNSUPPORTED'
12:53:21 PM 10/27/2022: }
12:53:21 PM 10/27/2022: Node.js v18.12.0
12:53:45 PM 10/27/2022: Error occured during the build.

I haven't been able to find the exact root cause, but since we were using the node:lts Docker build image, this error may stem from a recent version bump of node.

This likely stems from Webpack using a specific hash function that is linked to OpenSSL.

I was able to resolve this by adding the following ENV var to the build:

NODE_OPTIONS=--openssl-legacy-provider

We should investigate how to better resolve this. Perhaps it's from some outdated dependencies in this repo that are using an old version of Webpack.

2color avatar Oct 27 '22 16:10 2color