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
The code snippet fetch-ssl.ts attempts to retrieve the peer's SSL certificate information using res.connection.getPeerCertificate(). However, when running the script with Bun (bun run fetch-ssl.ts), an error occurs:
get ssl info error: 7 | port: 443,
8 | method: 'GET',
9 | rejectUnauthorized: false
10 | };
11 | const req = https.request(options, (res) => {
12 | const data = res.connection.getPeerCertificate();
^
TypeError: res.connection.getPeerCertificate is not a function. (In 'res.connection.getPeerCertificate()', 'res.connection.getPeerCertificate' is undefined)
at /Users/isaced/Downloads/network-test/fetch-ssl.js:12:41
at onceWrapper (node:events:165:55)
at emit (node:events:73:22)
at node:http:1006:60
This error indicates that the getPeerCertificate method is not available on the connection property of the response object (res) in the Bun environment.
On the other hand, running the same code with Node.js (node fetch-ssl.js) produces the expected output, retrieving the certificate information:
What version of Bun is running?
1.1.38+bf2f153f5
What platform is your computer?
Darwin 23.6.0 arm64 arm
What steps can reproduce the bug?
The code snippet
fetch-ssl.ts
attempts to retrieve the peer's SSL certificate information usingres.connection.getPeerCertificate()
. However, when running the script with Bun (bun run fetch-ssl.ts
), an error occurs:This error indicates that the
getPeerCertificate
method is not available on the connection property of the response object (res) in the Bun environment.On the other hand, running the same code with Node.js (
node fetch-ssl.js
) produces the expected output, retrieving the certificate information:Code:
What is the expected behavior?
No response
What do you see instead?
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: