Netlify build 32.1.0 new _Hash function error

site name hyak.uw.edu deploying from github repository.

The current version from a previous merge was deployed on April 16 without issue. The most recent merge now shows errors in the building step. The merge didn’t include changes to site configuration files, only to one of the .md files (Merge pull request #364 from UWrc/data-lifecycle-edits · UWrc/UWrc.github.io@32485a7 · GitHub) that are the majority of this repository - usually builds fail when there have been changes to yarn.lock, but that isn’t the case here.

The only apparent change is the netlify build 32.1.0 is being used for the build rather than 32.0.0 which was the last successful build and deploy (10 days prior to this attempt).

The error implies that

export NODE_OPTIONS=--openssl-legacy-provider

should be executed. Indeed, when I am locally deploying the version of the site I am working on, I am required to set this variable. However, it does not appear in the repository and has not been required in the repository previously. I’m not sure if this is something I should attempt to include in the configuration, and I’m not sure where that would be included. Netlify’s server is building this, so I’m not sure I could export a variable for this build. Is there some other incompatibility I can control and repair?

Here is the text of the build log after clearing the cache and retrying the build. The log notes one update that should be run; however, this update was suggested in the previous successful deployment and didn’t disrupt the build.

6:05:34 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
6:05:31 PM: Netlify Build                                                 
6:05:31 PM: ────────────────────────────────────────────────────────────────
6:05:31 PM: ​
6:05:31 PM: ❯ Version
6:05:31 PM:   @netlify/build 32.1.0
6:05:31 PM: ​
6:05:31 PM: ❯ Flags
6:05:31 PM:   accountId: 6042a1f75718f7094f454ede
6:05:31 PM:   baseRelDir: true
6:05:31 PM:   buildId: 6810259f95c78d30f8d9e207
6:05:31 PM:   deployId: 6810259f95c78d30f8d9e209
6:05:31 PM: ​
6:05:31 PM: ❯ Current directory
6:05:31 PM:   /opt/build/repo
6:05:31 PM: ​
6:05:31 PM: ❯ Config file
6:05:31 PM:   No config file was defined: using default values.
6:05:31 PM: ​
6:05:31 PM: ❯ Context
6:05:31 PM:   production
6:05:31 PM: ​
6:05:31 PM: Build command from Netlify app                                
6:05:31 PM: ────────────────────────────────────────────────────────────────
6:05:31 PM: ​
6:05:31 PM: $ yarn build
6:05:32 PM: yarn run v1.22.4
6:05:32 PM: $ docusaurus build
6:05:32 PM: Browserslist: caniuse-lite is outdated. Please run:
6:05:32 PM:   npx browserslist@latest --update-db
6:05:32 PM:   Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
6:05:33 PM: [en] Creating an optimized production build...
6:05:33 PM: [info] [webpackbar] Compiling Client
6:05:33 PM: [info] [webpackbar] Compiling Server
6:05:33 PM: node:internal/crypto/hash:79
6:05:33 PM:   this[kHandle] = new _Hash(algorithm, xofLen, algorithmId, getHashCache());
6:05:33 PM:                   ^
6:05:33 PM: Error: error:0308010C:digital envelope routines::unsupported
6:05:33 PM:     at new Hash (node:internal/crypto/hash:79:19)
6:05:33 PM:     at Object.createHash (node:crypto:139:10)
6:05:33 PM:     at module.exports (/opt/build/repo/node_modules/webpack/lib/util/createHash.js:135:53)
6:05:33 PM:     at NormalModule._initBuildHash (/opt/build/repo/node_modules/webpack/lib/NormalModule.js:417:16)
6:05:33 PM:     at handleParseError (/opt/build/repo/node_modules/webpack/lib/NormalModule.js:471:10)
6:05:33 PM:     at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:503:5
6:05:33 PM:     at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:358:12
6:05:33 PM:     at /opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:373:3
6:05:33 PM:     at iterateNormalLoaders (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
6:05:33 PM:     at iterateNormalLoaders (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
6:05:33 PM:     at /opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:236:3
6:05:33 PM:     at context.callback (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
6:05:33 PM:     at /opt/build/repo/node_modules/babel-loader/lib/index.js:59:71 {
6:05:33 PM:   opensslErrorStack: [
6:05:33 PM:     'error:03000086:digital envelope routines::initialization error',
6:05:33 PM:     'error:0308010C:digital envelope routines::unsupported'
6:05:33 PM:   ],
6:05:33 PM:   library: 'digital envelope routines',
6:05:33 PM:   reason: 'unsupported',
6:05:33 PM:   code: 'ERR_OSSL_EVP_UNSUPPORTED'
6:05:33 PM: }
6:05:33 PM: Node.js v22.15.0
6:05:33 PM: error Command failed with exit code 1. (https://ntl.fyi/exit-code-1)
6:05:33 PM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
6:05:33 PM: ​
6:05:33 PM: "build.command" failed                                        
6:05:33 PM: ────────────────────────────────────────────────────────────────
6:05:33 PM: ​
6:05:33 PM:   Error message
6:05:33 PM:   Command failed with exit code 1: yarn build (https://ntl.fyi/exit-code-1)
6:05:33 PM: ​
6:05:33 PM:   Error location
6:05:33 PM:   In Build command from Netlify app:
6:05:33 PM:   yarn build
6:05:33 PM: ​
6:05:33 PM:   Resolved config
6:05:33 PM:   build:
6:05:33 PM:     base: /opt/build/repo
6:05:33 PM:     command: yarn build
6:05:33 PM:     commandOrigin: ui
6:05:33 PM:     publish: /opt/build/repo/deploy
6:05:33 PM:     publishOrigin: ui
6:05:33 PM:   functionsDirectory: /opt/build/repo/netlify/functions
6:05:34 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
6:05:34 PM: Failing build: Failed to build site
6:05:34 PM: Finished processing build request in 51.14s

Thank you in advance for your help,

Kristen Finch
HPC Staff Scientist
University of Washington

Here’s an old post that links to relevant info:
https://answers.netlify.com/t/error-build-script/95081/2

Try changing your Build command in Netlify…

From:

yarn build

To:

NODE_OPTIONS='--openssl-legacy-provider' yarn build

Thank you, @nathanmartin . I placed this in my packages.json in the scripts section

"build": "NODE_OPTIONS='--openssl-legacy-provider' docusaurus build",

this allowed me to clear the Building Phase, but caused a new error in the Deploy phase

9:56:17 AM: Deploy site                                                   
9:56:17 AM: ────────────────────────────────────────────────────────────────
9:56:17 AM: ​
9:56:17 AM: Section completed: deploying
9:56:17 AM: ​
9:56:17 AM: Configuration error                                           
9:56:17 AM: ────────────────────────────────────────────────────────────────
9:56:17 AM: ​
9:56:17 AM:   Error message
9:56:17 AM:   Deploy did not succeed: Deploy directory 'deploy' does not exist
9:56:17 AM: ​
9:56:17 AM:   Resolved config
9:56:17 AM:   build:
9:56:17 AM:     base: /opt/build/repo
9:56:17 AM:     command: yarn build
9:56:17 AM:     commandOrigin: ui
9:56:17 AM:     publish: /opt/build/repo/deploy
9:56:17 AM:     publishOrigin: ui
9:56:17 AM:   functionsDirectory: /opt/build/repo/netlify/functions
9:56:18 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
9:56:18 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
9:56:18 AM: Failing build: Failed to build site

The Netlify AI helpbot suggested that I add the deploy directory to the repository for the static files during deployment, so I did. This allowed the site to clear all phases, but when I published it, the site was not longer available as if hyak.uw.edu did not exist. We have a build/ in our .gitignore and maybe there should also be a deploy/ there rather than how I set it up. I’ve reverted and I’m still looking into this issue.

Investigating the Stack Overflow answer you suggested tells me the NODE_OPTIONS is a workaround, but that Node.js is the wrong version. I am not sure if an update is needed on my end.

Anyway, thank you for your time.

This sounds like a potentially nonsense answer.

If the issue is that, you’re trying to deploy a folder called deploy as per:

6:05:33 PM:   Resolved config
6:05:33 PM:   build:
6:05:33 PM:     base: /opt/build/repo
6:05:33 PM:     command: yarn build
6:05:33 PM:     commandOrigin: ui
6:05:33 PM:     publish: /opt/build/repo/deploy    <--- The folder Netlify has been configured to deploy
6:05:33 PM:     publishOrigin: ui

But after your build completes, there is no deploy folder.

Then the issue is that either:

  1. Your build should produce a deploy folder, and it’s not for ‘some reason
    or
  2. Your build produces some other folder, and the configuration is wrong

Creating an empty deploy folder, would mean the folder exists when the build tries to deploy it.
But it wouldn’t necessarily mean there would be anything within that folder.
Thus causing you to successfully deploy an empty folder.

Confirm what the configuration should be by running the project locally.
Along with how your project behaves, what it produces etc.
Then set the Netlify configuration to match the local requirements.