[solved] H10 App Crashed Heroku error:0308010C:digital envelope routines::unsupported

System Information
  • Strapi Version: 3.6.2
  • Operating System: Heroku
  • Node Version: That is the problem

Heroku decided today to run my two years old instance of Strapi with node 17 instead of 14, which does not work.

Here is the fix (in package.json):

  "engines": {
    "node": "14.x",
  },

This will ensure that Heroku runs it with the right version.

More details about it here Heroku Node.js Support | Heroku Dev Center

I will paste the full error just for SEO reasons:

node:internal/crypto/hash:67
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^
Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:67:19)
    at Object.createHash (node:crypto:130:10)
    at module.exports (/tmp/build_a4a873d1/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/tmp/build_a4a873d1/node_modules/webpack/lib/NormalModule.js:417:16)
    at /tmp/build_a4a873d1/node_modules/webpack/lib/NormalModule.js:452:10
    at /tmp/build_a4a873d1/node_modules/webpack/lib/NormalModule.js:323:13
    at /tmp/build_a4a873d1/node_modules/loader-runner/lib/LoaderRunner.js:367:11
    at /tmp/build_a4a873d1/node_modules/loader-runner/lib/LoaderRunner.js:233:18
    at context.callback (/tmp/build_a4a873d1/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
    at /tmp/build_a4a873d1/node_modules/babel-loader/lib/index.js:59:103
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
Node.js v17.3.0
error Command failed with exit code 1.
       info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
-----> Build failed
       
       We're sorry this build is failing! You can troubleshoot common issues here:
       https://devcenter.heroku.com/articles/troubleshooting-node-deploys
       
       Some possible problems:
       
       - Dangerous semver range (>) in engines.node
         https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
       
       Love,
       Heroku
       
 !     Push rejected, failed to compile Node.js app.
 !     Push failed

hmmm based on this: node.js - Error message "error:0308010C:digital envelope routines::unsupported" - Stack Overflow

It must have been pulling an old version of node?

Keep in mind we never support odd versions of node as stated in our docs: Deployment - Strapi Developer Docs

Versions that have never been and will never be supported:

  • 9
  • 11
  • 13
  • 15
  • 17
  • 19
  • 21
  • ect ect

These are bleeding edge releases that will never be made LTS: Releases | Node.js

Yes, is normal that you don’t support odd numbers.

I’m worried because the error happened again last night even after the change I made above.

This is an app in production, so clients alert me very fast when the app is down.

Maybe it comes from Heroku, but the app broke and I just re-deployed it and it worked again, so I’m not that confident on my fix anymore.

Do you have any other recomendation?

Heroku installs the highest node version it can match from your package.json’s engine key. If you want a specific version of node, change the engine key to what you want.

The “error:0308010C:digital envelope routines::unsupported” occurs because Node.js v17 and later use OpenSSL v3.0 which has had breaking changes.

To resolve the error, set the NODE_OPTIONS environment variable to --openssl-legacy-provider

You can set this variable in heroku before the build

1 Like