bun
bun copied to clipboard
Implement Node's "tls" module
Version
0.1.4
Platform
Linux ubuntu 5.4.0-121-generic #137-Ubuntu SMP Wed Jun 15 13:33:07 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
What steps will reproduce the bug?
Requiring and trying to use the nodejs "tls" module doesn't work
.
Code:
import tls from "node:tls" console.log(tls.getCiphers())
How often does it reproduce? Is there a required condition?
No response
What is the expected behavior?
receive the Cipher list as a string.
What do you see instead?
TypeError: undefined is not an object (evaluating 'tls.getCiphers')
Additional information
No response
node's tls module isn't implemented yet
👀 following this one.
I do not understand why this is marked as "enhancement". So far as I understand, one of the Bun project goals is a complete implementation of Node.js. The TLS package is built-in to Node.js, and is widely used. This should instead be considered a high priority bug.
FWIW I came across this not because my code uses TLS directly, but because some code in my application ends up using the forever-agent package, which in turn requires TLS, which fails this way:
error: Cannot find package "tls" from "/home/david/Projects/akasharender/akashacms-perftest/node_modules/forever-agent/index.js"
does anyone knows if this has been solved already in Bun? I get the same error when installing mysql2
error: Cannot find package "tls" from "/Users/user/Documents/bun/node_modules/mysql2/lib/connection.js"
I am getting the same error too error: Cannot find package "tls" from ... when importing mysql
Bump on this, tls is a really important package
Bump - we'd love to switch and can't because of this.
puppeteer and playwright also depend on this
I've tried to run a nest app and this package is missing too :/
Having the same issue with a toy websocket app.
Do someone have any update ?
Bump. Cannot use Bun because of this issue. My app uses node-redis which relies on Node's tls module.
Thank you for bumping
We need net's Socket to work first. It will be a wrapper around Bun.connect & Bun.listen. The actual work involved to implement this won't be huge.
In Bun v0.5.1 TLS error disappear. But now I have another error:
21 | "node_modules/inherits/inherits_browser.js"(exports, module2) {
22 | module2.exports = function inherits(ctor, superCtor) {
23 | ctor.super_ = superCtor;
24 |
25 | ctor.prototype = Object.create(superCtor.prototype, {
^
TypeError: undefined is not an object (evaluating 'superCtor.prototype')
at inherits (node:util:25:37)
at /project_path.../node_modules/forever-agent/index.js:54:0
at /project_path.../node_modules/request/request.js:14:4
at /project_path.../node_modules/request/index.js:143:8
Error comes using danfojs-node
I don't know if it's a problem with bun or the dependency itself
Great that there is some progress here :+1:
However, with bun v5.5 , trying to run playwright produces another error (not sure if tls-related):
Error:
1 | import { chromium } from "@playwright/test";
3 | const browser = await chromium.launch();
^
TypeError: undefined is not an object (evaluating 'chromium.launch')
Reproducing is simple:
package.json:
{
"dependencies": {
"@playwright/test": "1.30.0",
"@playwright/test-runner": "0.9.24"
},
"type": "module"
}
main.ts:
import { chromium } from "@playwright/test";
const browser = await chromium.launch();
And then simply run
bun installnpx playwright installbun main.ts
I was trying to use bun, but I think this stops me for now. I got into this problem when using nodemailer for the first time. Thanks for the progress though.
A lot more of tls is implemented since this issue was last updated (mysql2 works, for example), including parts of
- createServer
- connect
Bun internally doesn’t compose the way node does which means things like https is supported even if not all of tls is implemented