Home > Software design >  Pushing Rails app to heroku gives me Error: error:0308010C:digital envelope routines::unsupported
Pushing Rails app to heroku gives me Error: error:0308010C:digital envelope routines::unsupported

Time:11-18

I have a Rails 7.x app I am trying to push to heroku and getting this error:

remote:        Running: rake assets:precompile
remote:        Compiling...
remote:        Compilation failed:
remote:        node:internal/crypto/hash:71
remote:          this[kHandle] = new _Hash(algorithm, xofLen);
remote:                          ^
remote:
remote:        Error: error:0308010C:digital envelope routines::unsupported
remote:            at new Hash (node:internal/crypto/hash:71:19)
remote:            at Object.createHash (node:crypto:133:10)
remote:            at module.exports (/tmp/build_b1f32be4/node_modules/webpack/lib/util/createHash.js:135:53)
remote:            at NormalModule._initBuildHash (/tmp/build_b1f32be4/node_modules/webpack/lib/NormalModule.js:417:16)
remote:            at handleParseError (/tmp/build_b1f32be4/node_modules/webpack/lib/NormalModule.js:471:10)
remote:            at /tmp/build_b1f32be4/node_modules/webpack/lib/NormalModule.js:503:5
remote:            at /tmp/build_b1f32be4/node_modules/webpack/lib/NormalModule.js:358:12
remote:            at /tmp/build_b1f32be4/node_modules/loader-runner/lib/LoaderRunner.js:373:3
remote:            at iterateNormalLoaders (/tmp/build_b1f32be4/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
remote:            at iterateNormalLoaders (/tmp/build_b1f32be4/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
remote:            at /tmp/build_b1f32be4/node_modules/loader-runner/lib/LoaderRunner.js:236:3
remote:            at context.callback (/tmp/build_b1f32be4/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
remote:            at /tmp/build_b1f32be4/node_modules/babel-loader/lib/index.js:44:71 {
remote:          opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
remote:          library: 'digital envelope routines',
remote:          reason: 'unsupported',
remote:          code: 'ERR_OSSL_EVP_UNSUPPORTED'
remote:        }
remote:
remote:        Node.js v18.12.1
remote:
remote:
remote:  !
remote:  !     Precompiling assets failed.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote:
remote:  !     Push failed

My node version locally is v18.12.1. I also saw a couple of issues where this might related to openssl. My openssl version local is OpenSSL 3.0.7 1 Nov 2022 (Library: OpenSSL 3.0.7 1 Nov 2022).

Any help appreciated!

CodePudding user response:

I tried quite a few things in attempts to fix this issue, but I think what finally did it was adding

 "engines": {
    "node": "16.18.1"
  }

...to my package.json file. Also I think the right way to do this is to go ahead and install the same version of node locally and re-run yarn install so your yarn.lock file is correct for that version.

Hope this helps someone!

  • Related