Avoid Digital Envelope Routine Error in Node.js
Got a weird "digital envelope routine::unsupported" error? Who doesn't? Let's get rid of it.
One day I started my node app, and it failed with a nasty-gram:
Error: error:0308010C:digital envelope routines::unsupported
Since node 17, OpenSSL 3.0 is supported, which moves algorithmss like MD4 to a legacy status -- the kind of legacy that throws errors on newer versions of Node.js.
If you see this error, it's because your on node 17+.
Fix 1: Downgrade
Easy, use node 16 or older.
Fix 2: Use Legacy Option
Or use new node with old openssl:
unset NODE_OPTIONS export NODE_OPTIONS=--openssl-legacy-provider
By the way, it wouldn't work inline for me, but there was some weird tooling involved in this story too:
NODE_OPTIONS=--openssl-legacy-provider node main.js
In the Future?
Obviously, we are not going to use OpenSSL legacy forever. The robot overlords will surely make us upgrade at some point.
I don't know when that is. As long as we have this error, we need to avoid it. Feels like a bug that needs fixed, probably in various places.