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

Error with NODE_OPTIONS #59

Closed
hupling opened this issue Jun 9, 2023 · 8 comments
Closed

Error with NODE_OPTIONS #59

hupling opened this issue Jun 9, 2023 · 8 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@hupling
Copy link

hupling commented Jun 9, 2023

I set the environment variable NODE_OPTIONS: -use-openssl-ca

> vitest run
 RUN  v0.20.3 /builds/xxx/frontend
⎯⎯⎯⎯⎯⎯ Unhandled Error ⎯⎯⎯⎯⎯⎯⎯
Error: Initiated Worker with invalid NODE_OPTIONS env variable: --use-openssl-ca is not allowed in NODE_OPTIONS
 ❯ new NodeError node:internal/errors:387:5
 ❯ new Worker node:internal/worker:198:13
 ❯ ThreadPool._addNewWorker node_modules/tinypool/dist/esm/index.js:500:20
 ❯ ThreadPool._ensureMinimumWorkers node_modules/tinypool/dist/esm/index.js:485:12
 ❯ new ThreadPool node_modules/tinypool/dist/esm/index.js:475:10
 ❯ new Tinypool node_modules/tinypool/dist/esm/index.js:739:31
 ❯ createPool node_modules/vitest/dist/chunk-vite-node-externalize.91ae6e85.mjs:7044:16
 ❯ node_modules/vitest/dist/chunk-vite-node-externalize.91ae6e85.mjs:9504:21
 ❯ Vitest.runFiles node_modules/vitest/dist/chunk-vite-node-externalize.91ae6e85.mjs:9521:7
 ❯ Vitest.start node_modules/vitest/dist/chunk-vite-node-externalize.91ae6e85.mjs:9442:5
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: {
  "code": "ERR_WORKER_INVALID_EXEC_ARGV",

You should not put the environment variable NODE_OPTIONS to the child process. It is automatically taken from the parent.

  // Only fail for explicitly provided env, this protects from failures
 // when NODE_OPTIONS from parent's env is used (which is the default).

https://github.com/nodejs/node/blob/v16.20.0/src/node_worker.cc#L513-L514

@Aslemammad Aslemammad added bug Something isn't working help wanted Extra attention is needed labels Jun 9, 2023
@Aslemammad
Copy link
Member

cc @sheremet-va is it vitest related?

@sheremet-va
Copy link
Member

cc @sheremet-va is it vitest related?

Yes, looks like it’s Vitest related. The version is too old though.

@eidottermihi
Copy link

This also occurs with latest vitest (0.32.0) which uses latest tinypool (0.5.0):

$ NODE_OPTIONS=--use-openssl-ca npm run test

> [email protected] test
> vitest


 DEV  v0.32.0 C:/Users/michael.prankl/git/myproject


Unhandled Errors 
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Vitest caught 1 unhandled error during the test run.
This might cause false positive tests. Resolve unhandled errors to make sure your tests are not affected.

⎯⎯⎯⎯⎯⎯⎯⎯Unhandled Error Error: Initiated Worker with invalid NODE_OPTIONS env variable: --use-openssl-ca is not allowed in NODE_OPTIONS
 ❯ new NodeError node:internal/errors:399:5
 ❯ new Worker node:internal/worker:205:13
 ❯ ThreadPool._addNewWorker node_modules/tinypool/dist/esm/index.js:533:20
 ❯ ThreadPool._ensureMinimumWorkers node_modules/tinypool/dist/esm/index.js:518:12
 ❯ new ThreadPool node_modules/tinypool/dist/esm/index.js:503:10
 ❯ new Tinypool node_modules/tinypool/dist/esm/index.js:772:31
 ❯ createThreadsPool node_modules/vitest/dist/vendor-cli-api.897427d4.js:7213:16
 ❯ node_modules/vitest/dist/vendor-cli-api.897427d4.js:7442:43
 ❯ Object.runTests node_modules/vitest/dist/vendor-cli-api.897427d4.js:7434:51

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯Serialized Error: {
  "code": "ERR_WORKER_INVALID_EXEC_ARGV",
}
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
 Test Files  no tests
      Tests  no tests
     Errors  1 error
   Start at  09:38:23
   Duration  70ms (transform 0ms, setup 0ms, collect 0ms, tests 0ms, environment 0ms, prepare 0ms)

@hupling
Copy link
Author

hupling commented Jun 13, 2023

I will use NODE_EXTRA_CA_CERTS

@hupling hupling closed this as completed Jun 13, 2023
@eidottermihi
Copy link

@hupling

I will use NODE_EXTRA_CA_CERTS

thats a possible workaround, yes. But the issue still remains, could you please reopen the issue?

https://nodejs.org/api/cli.html#node_optionsoptions clearly says that --use-openssl-ca is a valid option, so this error shouldn't occur IMHO.

@hupling hupling reopened this Jun 13, 2023
@Aslemammad
Copy link
Member

The thing is tinypool does not control this, but vitest does at its side, but let's have this issue open so @sheremet-va can watch it.

@AriPerkkio
Copy link
Member

Slightly related to vitest-dev/vitest#2702 where similar Node exec argv filtering is done to ensure workers are not passed incompatible options.

@AriPerkkio
Copy link
Member

Fixed by vitest-dev/vitest#2702. Vitest no longer passes all arguments to Tinypool.

There's nowadays another way to pass explicit exec argv to workers: vitest-dev/vitest#4383.

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

No branches or pull requests

5 participants