Open ilbertt opened 7 months ago
mtls support for undici is missing too
# index.mjs
import { fetch, Agent } from 'undici';
import fs from 'fs';
const res = await fetch('https://certauth.idrix.fr/json', {
dispatcher: new Agent({
connect: {
cert: fs.readFileSync('cert.pem'),
key: fs.readFileSync('key.pem'),
}
})
});
console.log(res.status, res.statusText);
console.log(await res.json());
nodejs can run it without problem but bun override udinci fetch with bun fetch which does not support mtls
Any updates?
What version of Bun is running?
1.0.22
What platform is your computer?
Darwin 23.2.0 arm64 arm
What steps can reproduce the bug?
I'm trying to execute an HTTPS request to a server that has a self signed TLS certificate and requires mTLS authentication. So, I'm basically importing the https library and executing the request using an https.Agent. Since the server has a self signed TLS certificate, I'm setting the rejectUnauthorized field of the https.Agent options to false. Here's my pseudo-code:
What is the expected behavior?
I'm expecting to be able to make the HTTPS request without any certificate error, since if I transpile the code to js and execute it with Node (v20), everything goes fine and the request is successfully received from the server.
What do you see instead?
The request gives me this error:
Additional information
Might be related: #6520