deno: TLSSocket._start seems never set
Describe the bug
Steps to Reproduce
import sql from "npm:mssql";
const connectionPool = new sql.ConnectionPool({
server: "localhost",
database: "SomeDatabase",
user: "user",
password: "password",
options: {
trustedConnection: true,
trustServerCertificate: true,
},
});
const connection = await connectionPool.connect();
console.log("Connected");
Expected behavior
Should work.
Environment
- OS: Windows 10
- deno version: 1.28.1
- std version: 1.165.0
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 11
- Comments: 20 (4 by maintainers)
Commits related to this issue
- fix(node): implement TLSSocket._start (#20120) Closes https://github.com/denoland/deno/issues/19983 Closes https://github.com/denoland/deno/issues/18303 Closes https://github.com/denoland/deno/issu... — committed to denoland/deno by littledivy a year ago
- fix(node): implement TLSSocket._start (#20120) Closes https://github.com/denoland/deno/issues/19983 Closes https://github.com/denoland/deno/issues/18303 Closes https://github.com/denoland/deno/issu... — committed to littledivy/deno by littledivy a year ago
- fix(node): implement TLSSocket._start (#20120) Closes https://github.com/denoland/deno/issues/19983 Closes https://github.com/denoland/deno/issues/18303 Closes https://github.com/denoland/deno/issu... — committed to denoland/deno by littledivy a year ago
Do you have sample for this? I still got the same error as the issue creator with latest deno and latest npm sqlserver package 🤔
@bartlomieju It’s pretty much as simple as it gets. Probably it’s something stupid.
the mssql npm library and nodemailer are working now🥳
I found the relevant Node code: https://github.com/nodejs/node/blob/main/lib/_tls_wrap.js#L952
It calls
this._handle.start()
which doesn’t seem to be implemented yet. It looks likethis._handle
is a Socket but it doesn’t have astart
method. Currently, the Node Compat version (_tls_wrap.ts
) is less than 1/3 the number of lines as the Node version (_tls_wrap.js
), so I’m not sure how close it is to functioning in Deno, but I’d very much like to help get it working and will continue digging into it.deno 1.37.0
Hey hey, unfortunately I’m getting a similar error for nodemailer:
The offending parts in the code I marked here
Curiously
this._socket.removeListener
is called beforetls.connect
so this must have worked before. I don’t understand.Now I haven’t worked on this project for a while so I can’t exclude user error but it seems pretty deep in the core code.
Hey folks, I’m getting socket hangup error when connecting to azure SQL db I used to get the same error before, but when I upgraded to 1.36.3 from 1.36.1 the issue happening here got fixed but now I’m getting socket hangup error.
Edit: I tested my connection setting with mssql in pure node js (made a tiny script just to see if I’m tripping with my connection setting). Well the pure node js works fine, no issues, could query a table too. same setting, same latest mssql version (9.1.3 ).
then I went and tested the code using deno in isolation, again same setting, same latest mssql version (9.1.3) and I get the same error as my original project. So its definetly something to do with the latest changes in deno.
This is the stacktrace:
at file:///.../deno/npm/registry.npmjs.org/mssql/9.1.3/lib/tedious/connection-pool.js:70:17 at Connection.onConnect (file:///.../deno/npm/registry.npmjs.org/tedious/15.1.3/lib/connection.js:1012:9) at Object.onceWrapper (ext:deno_node/_events.mjs:507:26) at Connection.emit (ext:deno_node/_events.mjs:382:28) at Connection.emit (file:///.../deno/npm/registry.npmjs.org/tedious/15.1.3/lib/connection.js:1040:18) at Connection.socketError (file:///.../deno/npm/registry.npmjs.org/tedious/15.1.3/lib/connection.js:1395:12) at Connection.socketEnd (file:///...l/deno/npm/registry.npmjs.org/tedious/15.1.3/lib/connection.js:1415:12) at Socket.<anonymous> (file:///.../deno/npm/registry.npmjs.org/tedious/15.1.3/lib/connection.js:1155:16) at Socket.emit (ext:deno_node/_stream.mjs:1857:11) at endReadableNT (ext:deno_node/_stream.mjs:3646:16)
npm:nodemailer
seems having the same problem denoland/deno_std#3035Can anyone help with this? From what I see, the
_start
function of theTLSSocket
class in the file_tls_wrap.ts
is missing. I am very willing to help work on it, but I don’t know what the_start
function should do.It seems like the TLS module for Node Compat flat out doesn’t work because of this, and it doesn’t seem straightforward to update a typical Node library to use Deno’s primary TLS support instead of the Node Compat support due to major differences between the APIs.
I would appreciate any help on this, and would be willing to write code for it if someone can provide direction (e.g., what the
_start
function is supposed to do).If it helps, here is another scenario in which this issue can also be seen:
Error stack trace: