Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

node v17.1.0 doesn't accept --openssl-legacy-provider on Arch Linux #2155

Closed
Felixoid opened this issue Dec 10, 2021 · 10 comments · Fixed by #2172
Closed

node v17.1.0 doesn't accept --openssl-legacy-provider on Arch Linux #2155

Felixoid opened this issue Dec 10, 2021 · 10 comments · Fixed by #2172
Labels
bug Something isn't working investigate

Comments

@Felixoid
Copy link

🐛 Bug report

Describe the bug

wrangler dev and wrangler preview fail to run with error

Reproduce the bug

A list of steps to reproduce the bug.

  1. Install yarn global add @cloudflare/wrangler
  2. Clone https://github.com/ClickHouse/clickhouse-website-worker
  3. Run wrangler preview
  4. See error:
[felixoid@chelix clickhouse-website-worker]$ ~/.yarn/bin/wrangler --version
wrangler 1.19.5
[felixoid@chelix clickhouse-website-worker]$ ~/.yarn/bin/wrangler preview
/usr/bin/node: bad option: --openssl-legacy-provider
Error: failed to execute `"/usr/bin/node" "--openssl-legacy-provider" "/home/felixoid/.cache/.wrangler/wranglerjs-1.19.5" "--output-file=/tmp/.wranglerjs_outputtBWSw" "--wasm-binding=WASM_MODULE" "--webpack-config=webpack.config.js"`: exited with exit status: 9

Expected behavior

I'd be happy to see at least one of rust and nodejs solutions working :-j

Environment and versions

Fill out the following information about your environment.

  • operating system: arch linux
  • output of wrangler -V: wrangler 1.19.5
  • output of node -v: v17.1.0
  • content of wrangler.toml:
name = "clickhouse-website"
type = "webpack"
account_id = "d4fd593eebab2e3a58a599400c4cd64d"
workers_dev = true
webpack_config = "webpack.config.js"
kv-namespaces = [
    { binding = "RATING", id = "11a8aef802fa45b89904113bd4be4566", preview_id = "68b329da9893e34099c7d8ad5cb9c940" },
    { binding = "RATING_PER_IP", id = "bfbab0338f6a47dda76cb37d7c6e556a", preview_id = "d784fa8b6d98d27699781bd9a7cf19f0" }
]

[env.production]
route = "clickhouse.com/*"
zone_id = "4fc6fb1d46e87851605aa7fa69ca6fe0"
kv-namespaces = [
    { binding = "RATING", id = "fab071214bbc4bc8bce73f8986701aec", preview_id = "deb417b8c4566603806f045b931503be" },
    { binding = "RATING_PER_IP", id = "a8e11f15962b49e28c114714872edfb7", preview_id = "2c744dffd279d7e9e0910ce594eb4f4f" }
]
@Felixoid Felixoid added the bug Something isn't working label Dec 10, 2021
@threepointone
Copy link
Contributor

node v17.1.0 definitely supports that flag. What's happening here is that yarn is picking up an older version of node on your machine. We had a similar issue here cloudflare/workers-sdk#33. I don't know much about yarn 2/3's internals to recommend how to pick up the right version of node, but a workaround would be yarn global remove @cloudflare/wrangler, then npm install -g @cloudflare/wrangler , then try wrangler preview (or, figure out how to get yarn to use your latest version of node)

Closing this issue, but let me know if you need further assistance.

@Felixoid
Copy link
Author

Felixoid commented Dec 13, 2021

Ermm... I am not sure why, but my system nodejs binary thinks other way:

┌[09:45:41] felixoid@chelix:~ 
└>ѳ> /usr/bin/node --version
v17.1.0
┌[09:45:43] felixoid@chelix:~ 
└>ѳ> /usr/bin/node --openssl-legacy-provider
/usr/bin/node: bad option: --openssl-legacy-provider
┌[09:45:45] felixoid@chelix:~ 
└>ѳ> pacman -Qo /usr/bin/node
/usr/bin/node is owned by nodejs 17.1.0-3

Rollback to 1.18.0 is a temporary workaround for me, but I'd rather say that it's at least non-yarn issue.

upd the nodejs package was updated a few days ago to 17.2, but I still have the same issue after the upgrade

┌[09:55:59] felixoid@chelix:~ 
└>ѳ> /usr/bin/node --version
v17.2.0
┌[09:55:59] felixoid@chelix:~ 
└>ѳ> /usr/bin/node --openssl-legacy-provider
/usr/bin/node: bad option: --openssl-legacy-provider

Here's the configuration of binary https://github.com/archlinux/svntogit-community/blob/461ff1c2d1af0aa73409d293168669a9ea96899c/trunk/PKGBUILD#L26-L36

@threepointone
Copy link
Contributor

I'll reopen this issue for now, but - on my machine:

image

image

@Felixoid
Copy link
Author

Felixoid commented Dec 13, 2021

I think it should be related to https://nodejs.org/en/blog/release/v17.0.0/#openssl-3-0

But Arch Linux uses the shared openssl

>±> pacman -Q openssl 
openssl 1.1.1.l-1

It looks like wrangler makes an assumption for a key openssl-legacy-provider based on nodejs version, but the heuristic is a bit more complex.

update: as one of possible and reliable ways to figure it out:

node --help | grep openssl-legacy-provider

It returns nothing for me

@threepointone
Copy link
Contributor

Ugh, this is clearly annoying, sorry that you're bumping into it. We have to currently absorb this problem because we're using webpack 4 and cannot update it here. (In wrangler2 we're doing away with webpack altogether, and will have automation to upgrade older projects)

I think a better solution here is to modify the clickhouse template; change type = "webpack" to type = "javascript" and use a builder like esbuild (or even webpack5) instead (instructions: https://developers.cloudflare.com/workers/cli-wrangler/configuration#build) The webpack config isn't very complicated so I it shouldn't be too hard.

Another option is to downgrade node, and use v16+, which is supported and should work just fine right now.

Sorry again for the trouble!

@Felixoid Felixoid changed the title node v17.1.0 doesn't accept --openssl-legacy-provider node v17.1.0 doesn't accept --openssl-legacy-provider on Arch Linux Dec 13, 2021
@outloudvi
Copy link

For whoever is stuck by this, temporarily changing into another Node.js version may help (e.g. nvm or tj/n).

For example, me using tj/n:

n install lts
n exec lts wrangler publish

@artob
Copy link

artob commented Dec 17, 2021

I'll note that I'm running into this problem also with Homebrew on macOS 11.6.1 (ARM64):

$ wrangler build && wrangler publish
/opt/homebrew/bin/node: bad option: --openssl-legacy-provider
...
$ node --version
v17.2.0

update: as one of possible and reliable ways to figure it out:

node --help | grep openssl-legacy-provider

It returns nothing for me

Indeed, this returns nothing for me as well with Node.js v17.2.0 installed via Homebrew.

@threepointone
Copy link
Contributor

We're open to PRs that could potentially detect this situation and conditionally add the flag.

@threepointone
Copy link
Contributor

This is fixed in #2172 (thanks @eagleflo!). You can test this out by checking out this repo and installing locally. We'll do a release soon that includes this.

@Flynsarmy
Copy link

$ wrangler --version
wrangler 1.19.6

$ /usr/local/bin/node --version
v17.3.0

$ /usr/local/bin/node --open-legacy-provider
/usr/local/bin/node: bad option: --open-legacy-provider

$ wrangler dev
/usr/local/bin/node: bad option: --openssl-legacy-provider
Error: failed to execute `"/usr/local/bin/node" "--openssl-legacy-provider" "/Users/myuser/Library/Caches/.wrangler/wranglerjs-1.19.6" "--output-file=/var/folders/yl/hlnm4n1j05g6x987xbh1xyg00000gn/T/.wranglerjs_output4Mn4X" "--wasm-binding=WASM_MODULE" "--no-webpack-config=1" "--use-entry=/Users/myuser/htdocs/cf-test/index.js"`: exited with exit status: 9

OSX 12.0.1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working investigate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants