Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails with Node.js 17 #805

Closed
jesec opened this issue Oct 31, 2021 · 8 comments · Fixed by #868
Closed

Fails with Node.js 17 #805

jesec opened this issue Oct 31, 2021 · 8 comments · Fixed by #868
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@jesec
Copy link
Contributor

jesec commented Oct 31, 2021

Bug: webpack/webpack#14532

@styfle styfle added the help wanted Extra attention is needed label Oct 31, 2021
@styfle
Copy link
Member

styfle commented Nov 16, 2021

Fixed in #809

@styfle styfle closed this as completed Nov 16, 2021
@jesec
Copy link
Contributor Author

jesec commented Nov 29, 2021

For some reasons, #809 and 0.32.0 does not resolve the issue.

ncc: Version 0.32.0
ncc: Compiling file index.js into CJS
Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:67:19)
    at Object.createHash (node:crypto:130:10)
    at hashOf (/home/jc/flood/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:37:1890023)
    at ncc (/home/jc/flood/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:37:1894488)
    at runCmd (/home/jc/flood/node_modules/@vercel/ncc/dist/ncc/cli.js.cache.js:1:52268)
    at Object.819 (/home/jc/flood/node_modules/@vercel/ncc/dist/ncc/cli.js.cache.js:1:48838)
    at __webpack_require__ (/home/jc/flood/node_modules/@vercel/ncc/dist/ncc/cli.js.cache.js:1:59076)
    at /home/jc/flood/node_modules/@vercel/ncc/dist/ncc/cli.js.cache.js:1:59288
    at /home/jc/flood/node_modules/@vercel/ncc/dist/ncc/cli.js.cache.js:1:59349
    at Object.<anonymous> (/home/jc/flood/node_modules/@vercel/ncc/dist/ncc/cli.js:8:28) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

@jesec
Copy link
Contributor Author

jesec commented Nov 29, 2021

The issue may have something to do with ncc's failure to bundle the WebAssembly modules. I encounter some issues with the WebAssembly modules in the past. However, in this case, the issue could prevent webpack from using its own hash implementation:

https://github.com/webpack/webpack/tree/main/assembly/hash

This could become a bigger problem in next version of webpack, since xxhash64 would become default, and there is no OpenSSL implementation to fallback to.

@styfle styfle reopened this Dec 3, 2021
@styfle
Copy link
Member

styfle commented Dec 3, 2021

Can you share steps to reproduce the issue? Then @sokra can take a look too.

@jesec
Copy link
Contributor Author

jesec commented Dec 3, 2021

It is very simple.

Install Node v17, and run ncc on any project.

@styfle
Copy link
Member

styfle commented Dec 3, 2021

I see. There’s a PR to add Node 16 support #801

I haven’t tried Node 17 yet but it looks like the hash algo used is not supported by crypto.createHash()

Probably md4 was dropped so we can try sha1 instead.

@styfle styfle changed the title Bump to webpack@5.61.0 to make ncc work on Node 17 Fails with Node.js 17 Dec 3, 2021
@denik1981
Copy link

Any news with this? I can confirm the problem is with Node 17.
Seems to be working well with Node 16.

@Piszmog
Copy link

Piszmog commented Jan 17, 2022

I was able to get it to work with Node 17 with a hacky workaround,

I added the following to my scripts in package.json

"buildv17": "node --openssl-legacy-provider ./node_modules/@vercel/ncc/dist/ncc/cli.js build"

@styfle styfle added the bug Something isn't working label Jan 17, 2022
@kodiakhq kodiakhq bot closed this as completed in #868 Feb 11, 2022
kodiakhq bot pushed a commit to vercel/next.js that referenced this issue May 23, 2022
## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`

`yarn dev` failed (exit 1) on Node.js 17 & Node.js 18:

```
ncc_amp_optimizer failed because error:0308010C:digital envelope routines::unsupported
[...]
ncc_next__react_dev_overlay failed because error:0308010C:digital envelope routines::unsupported
```

The issue was reported to `@vercel/ncc` (vercel/ncc#805) and fixed by vercel/ncc#868, and `@vercel/ncc@0.33.2` includes the fix. However, Next.js still uses `@vercel/ncc@0.33.1` in `devDependencies`.

The PR bump `@vercel/ncc` to the latest version (which is 0.33.4).
herschel666 added a commit to villekulla-nma/booking that referenced this issue May 26, 2022
anthonyfok added a commit to OpenDRR/actions-gh-pages that referenced this issue Jun 10, 2022
Fixes "Error: error:0308010C:digital envelope routines::unsupported"
as Debian's nodejs v16.15.0 is already compiled with OpenSSL 3.

See vercel/ncc#805

The full error log is as follows:

> ncc build ./src/index.ts -o lib --minify

ncc: Version 0.27.0
ncc: Compiling file index.js
Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:67:19)
    at Object.createHash (node:crypto:130:10)
    at hashOf (/home/foka/OpenDRR/actions-gh-pages/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:3253134)
    at ncc (/home/foka/OpenDRR/actions-gh-pages/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:3256648)
    at runCmd (/home/foka/OpenDRR/actions-gh-pages/node_modules/@vercel/ncc/dist/ncc/cli.js.cache.js:1:51537)
    at Object.819 (/home/foka/OpenDRR/actions-gh-pages/node_modules/@vercel/ncc/dist/ncc/cli.js.cache.js:1:48344)
    at __webpack_require__ (/home/foka/OpenDRR/actions-gh-pages/node_modules/@vercel/ncc/dist/ncc/cli.js.cache.js:1:55043)
    at /home/foka/OpenDRR/actions-gh-pages/node_modules/@vercel/ncc/dist/ncc/cli.js.cache.js:1:55194
    at /home/foka/OpenDRR/actions-gh-pages/node_modules/@vercel/ncc/dist/ncc/cli.js.cache.js:1:55220
    at Object.<anonymous> (/home/foka/OpenDRR/actions-gh-pages/node_modules/@vercel/ncc/dist/ncc/cli.js:8:28) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
LuighiV pushed a commit to openpolitica/create-openpolitica-nextjs-app that referenced this issue Aug 24, 2022
## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`

`yarn dev` failed (exit 1) on Node.js 17 & Node.js 18:

```
ncc_amp_optimizer failed because error:0308010C:digital envelope routines::unsupported
[...]
ncc_next__react_dev_overlay failed because error:0308010C:digital envelope routines::unsupported
```

The issue was reported to `@vercel/ncc` (vercel/ncc#805) and fixed by vercel/ncc#868, and `@vercel/ncc@0.33.2` includes the fix. However, Next.js still uses `@vercel/ncc@0.33.1` in `devDependencies`.

The PR bump `@vercel/ncc` to the latest version (which is 0.33.4).
rickstaa added a commit to rickstaa/top-issues-action that referenced this issue Sep 25, 2022
This commit updates the documentation and updates @vercel/ncc to prevent
a opensll error (see vercel/ncc#805).
imaharu added a commit to globis-org/sre-actions that referenced this issue Mar 22, 2024
imaharu added a commit to globis-org/sre-actions that referenced this issue Mar 22, 2024
imaharu added a commit to globis-org/sre-actions that referenced this issue Mar 22, 2024
* deprecatedになってたのでnode versionを上げる

* node version upでエラーが発生したライブラリをversion up

ref: vercel/ncc#805

* feat: build all actions

* GHAの結果が帰ってこないので再PUSH

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants