Open jameslporter opened 4 months ago
Not sure if it's related I had a working self singed certificate solution using Vite's "devserver" with bun version 1.1.4.
server: {
port: Number(process.env.VITE_DEV_SERVER_PORT),
https: {
key: fs.readFileSync('.tools/cert/localhost.key'),
cert: fs.readFileSync('.tools/cert/localhost.crt'),
ca: fs.readFileSync('.tools/cert/localhost.pem'),
},
proxy: {
'/api': {
target: https://localhost:${process.env.SERVER_PORT}
,
changeOrigin: true,
secure: false,
rejectUnauthorized: false,
},
},
After upgrading to 1.1.18 I get the following error:
Error: 40289468F5140000:error:0A00045C:SSL routines:ssl3_read_bytes:tlsv13 alert certificate required:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1590:SSL alert number 116
I figured out why I was getting this error...
I'm doing "NODE_TLS_REJECT_UNAUTHORIZED=0" in my .env.development environment file. I then load it before starting my server. This was working fine in bun version 1.1.4 but after changing to bun 1.1.8 I have to explicitly export at terminal window level.
export NODE_TLS_REJECT_UNAUTHORIZED=0 then start my server. For some reason the "NODE_TLS_REJECT_UNAUTHORIZED=0" entry in my environment file gets overwritten to "undefined" in 1.1.18
What version of Bun is running?
1.1.8
What platform is your computer?
Linux 6.9.1 x86_64 unknown (nixos)
What steps can reproduce the bug?
init a javascript project create devProxy.js with the contents of this gist and adjust the hostname parameter. add a script named devProxy: "bun devProxy.js" to package.json bun run devProxy First request successfull, second request fails. Adjust script to "node devProxy.js" and then bun run devProxy works as expected.
What is the expected behavior?
That the script does not crash after the first request.
What do you see instead?
bun run devProxy
$ bun devProxy.js ConnectionClosed: The socket connection was closed unexpectedly. For more information, pass
verbose: true
in the second argument to fetch() path: "http://localhost/tours?_rsc=1aeee"Bun v1.1.8 (Linux x64) error: script "devProxy" exited with code 1
Additional information
I'm using nixos so that's why I have an older version of bun. I initially tried to go my usual route of using asdf-vm with the bun plugin but that failed due to dynamically linked libraries which is not kosher with nixos. There's a lot I love about nixos but I wouldn't recommend it for developers ironically. Even tools like android studio are not functional despite there being a package but I digress :)
If this is already fixed in a newer version let me know and I'll go poke the nixos package maintainers.
Just tried on my gentoo desktop with asdf and latest bun but ran into a problem with devcert package not being able to install the certificate. Guess that's another bug report to add to my list :jo