You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
NODE_TLS_REJECT_UNAUTHORIZED environment variable not respected in applyToFetchOptions #2601
Describe the bug
I'm using @kubernetes/client-node to send HTTP requests to an apiserver with a self-signed certificate. I can't provide the CA, so I'm trying to use NODE_TLS_REJECT_UNAUTHORIZED=0 to skip the tls verification. However, this doesn't work.
Client Version
1.3.0
Server Version
N/A
To Reproduce
Steps to reproduce the behavior:
import*ask8sfrom'@kubernetes/client-node';importfetchfrom'node-fetch';consturl="https://localhost:443";// server with self-signed certificateconstkc=newk8s.KubeConfig();constres=awaitfetch(url,awaitkc.applyToFetchOptions({}));console.log(res.status);
NODE_TLS_REJECT_UNAUTHORIZED=0 node test.js
(node:211892) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use `node --trace-warnings ...` to show where the warning was created)
/home/tw/code/javascript/node_modules/node-fetch/lib/index.js:1501
reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err));
^
FetchError: request to https://localhost:8443/ failed, reason: self-signed certificate;if the root CA is installed locally, try running Node.js with --use-system-ca
at ClientRequest.<anonymous> (/home/0x5457/code/test/node_modules/node-fetch/lib/index.js:1501:11)
at ClientRequest.emit (node:events:507:28)
at emitErrorEvent (node:_http_client:104:11)
at TLSSocket.socketErrorListener (node:_http_client:518:5)
at TLSSocket.emit (node:events:507:28)
at emitErrorNT (node:internal/streams/destroy:170:8)
at emitErrorCloseNT (node:internal/streams/destroy:129:3)
at process.processTicksAndRejections (node:internal/process/task_queues:90:21) {
type: 'system',
errno: 'DEPTH_ZERO_SELF_SIGNED_CERT',
code: 'DEPTH_ZERO_SELF_SIGNED_CERT'
}
Expected behavior
Print status code 200
Environment (please complete the following information):
Hi, I was able to reproduce this issue on my local setup (Node.js v24.4.1, Ubuntu 24.04).
I’d like to work on fixing this . Could you please assign it to me?
“Hi 👋 I commented a f
One day ago and I’m still interested in contributing to this issue. Could you please let me know if it’s okay for me to work on it? Thanks!”
Activity
abdulfarid-dev commentedon Sep 5, 2025
Hi, I was able to reproduce this issue on my local setup (Node.js v24.4.1, Ubuntu 24.04).
I’d like to work on fixing this . Could you please assign it to me?
Thanks!
abdulfarid-dev commentedon Sep 6, 2025
“Hi 👋 I commented a f
One day ago and I’m still interested in contributing to this issue. Could you please let me know if it’s okay for me to work on it? Thanks!”
0x5457 commentedon Sep 7, 2025
Hi @abdulfarid-dev ,
I'm already working on fixing this issue in PR #2602. I'll continue handling it until the fix is complete.
Thanks for your willingness to help!