Deploying NodeJS App

Hi.
I am trying to deploy my NodeJS onto fly.io but I keep getting the following error:

#12 4.815 Error: error:0308010C:digital envelope routines::unsupported
#12 4.815     at new Hash (node:internal/crypto/hash:71:19)
#12 4.815     at Object.createHash (node:crypto:133:10)
#12 4.815     at module.exports (/app/node_modules/webpack/lib/util/createHash.js:135:53)
#12 4.815     at NormalModule._initBuildHash (/app/node_modules/webpack/lib/NormalModule.js:417:16)
#12 4.815     at handleParseError (/app/node_modules/webpack/lib/NormalModule.js:471:10)
#12 4.815     at /app/node_modules/webpack/lib/NormalModule.js:503:5
#12 4.815     at /app/node_modules/webpack/lib/NormalModule.js:358:12
#12 4.815     at /app/node_modules/loader-runner/lib/LoaderRunner.js:373:3
#12 4.815     at iterateNormalLoaders (/app/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
#12 4.815     at iterateNormalLoaders (/app/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
#12 4.815     at /app/node_modules/loader-runner/lib/LoaderRunner.js:236:3
#12 4.815     at runSyncOrAsync (/app/node_modules/loader-runner/lib/LoaderRunner.js:130:11)
#12 4.815     at iterateNormalLoaders (/app/node_modules/loader-runner/lib/LoaderRunner.js:232:2)
#12 4.815     at Array.<anonymous> (/app/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
#12 4.815     at Storage.finished (/app/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
#12 4.815     at /app/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
#12 7.353
#12 7.353   When setting `useBuiltIns: 'usage'`, polyfills are automatically imported when needed.
#12 7.353   Please remove the direct import of `@babel/polyfill` or use `useBuiltIns: 'entry'` instead.
#12 7.388 /app/node_modules/loader-runner/lib/LoaderRunner.js:114
#12 7.388 			throw e;
#12 7.388 			^
#12 7.388
#12 7.388 Error: error:0308010C:digital envelope routines::unsupported
#12 7.388     at new Hash (node:internal/crypto/hash:71:19)
#12 7.388     at Object.createHash (node:crypto:133:10)
#12 7.388     at module.exports (/app/node_modules/webpack/lib/util/createHash.js:135:53)
#12 7.388     at NormalModule._initBuildHash (/app/node_modules/webpack/lib/NormalModule.js:417:16)
#12 7.388     at handleParseError (/app/node_modules/webpack/lib/NormalModule.js:471:10)
#12 7.388     at /app/node_modules/webpack/lib/NormalModule.js:503:5
#12 7.388     at /app/node_modules/webpack/lib/NormalModule.js:358:12
#12 7.388     at /app/node_modules/loader-runner/lib/LoaderRunner.js:373:3
#12 7.388     at iterateNormalLoaders (/app/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
#12 7.388     at iterateNormalLoaders (/app/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
#12 7.388     at /app/node_modules/loader-runner/lib/LoaderRunner.js:236:3
#12 7.388     at context.callback (/app/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
#12 7.388     at /app/node_modules/cache-loader/dist/index.js:147:7
#12 7.388     at /app/node_modules/graceful-fs/graceful-fs.js:61:14
#12 7.388     at FSReqCallback.oncomplete (node:fs:198:23) {
#12 7.388   opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
#12 7.388   library: 'digital envelope routines',
#12 7.388   reason: 'unsupported',
#12 7.388   code: 'ERR_OSSL_EVP_UNSUPPORTED'
#12 7.388 }
#12 7.388
#12 7.388 Node.js v18.16.0
------

I have tried just about everything to get this deployed, as it is a old app which was last deployed on Heroku free tier.

Any tips or guidance on how I can get around this would be appricated.

Hi,

Since the error mentions ERR_OSSL_EVP_UNSUPPORTED that suggests something that was supported, but no longer is. I see you are running Node 18 at the bottom (latest version) and so that suggests to me the app was written for an older version (that you had on Heroku) :thinking:. Which would explain why it worked there but not when moved to Fly.

Sure enough Node 17 lists that very error code in the changelog:

So … possible options:

  1. Drop your Node back down to whatever version you had on Heroku (usually set at the top of the Dockerfile, if you have one).
  2. Some people say you can support legacy versions by adding this environment variable. You could add it to fly.toml as it does not need to be secret: NODE_OPTIONS="--openssl-legacy-provider"
  3. Update your app’s code so it doesn’t use an unsupported feature. That would clearly be the best option and mean you could then use the latest version of Node. But it would mean more work for you to update your app.
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.